summaryrefslogtreecommitdiff
path: root/lib/main_common.dart
diff options
context:
space:
mode:
authormirror <mirror@localhost>2026-11-22 08:41:00 +0900
committermirror <mirror@localhost>2026-11-22 08:41:00 +0900
commit449d8b74bd6d9dae98a07254cdfad677b920e7b0 (patch)
treec131c3528c4d517f56e19b854a7453fedb097d40 /lib/main_common.dart
downloadaves-src-master.tar.gz
aves-src-master.zip
snapshot of aves v1.13.12 (secrets removed: android/app/google-services.json)HEADv1.13.12master
Diffstat (limited to 'lib/main_common.dart')
-rw-r--r--lib/main_common.dart45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/main_common.dart b/lib/main_common.dart
new file mode 100644
index 0000000..c5eb154
--- /dev/null
+++ b/lib/main_common.dart
@@ -0,0 +1,45 @@
+import 'dart:isolate';
+
+import 'package:aves/app_flavor.dart';
+import 'package:aves/services/common/services.dart';
+import 'package:aves/widgets/aves_app.dart';
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:leak_tracker/leak_tracker.dart';
+
+void mainCommon(AppFlavor flavor, {Map? debugIntentData}) {
+// HttpClient.enableTimelineLogging = true; // enable network traffic logging
+// debugPrintGestureArenaDiagnostics = true;
+
+// Invert oversized images (debug mode only)
+// cf https://flutter.dev/docs/development/tools/devtools/inspector
+// but unaware of device pixel ratio as of Flutter 2.2.1: https://github.com/flutter/flutter/issues/76208
+//
+// MaterialApp.checkerboardOffscreenLayers
+// cf https://flutter.dev/docs/perf/rendering/ui-performance#checking-for-offscreen-layers
+//
+// MaterialApp.checkerboardRasterCacheImages
+// cf https://flutter.dev/docs/perf/rendering/ui-performance#checking-for-non-cached-images
+//
+// flutter run --profile --trace-skia
+
+ initPlatformServices();
+
+ Isolate.current.addErrorListener(RawReceivePort((pair) {
+ final List<dynamic> errorAndStacktrace = pair;
+ reportService.recordError(errorAndStacktrace.first, errorAndStacktrace.last);
+ }).sendPort);
+
+ // Errors during the widget build phase will show by default:
+ // - in debug mode: error on red background
+ // - in profile/release mode: plain grey background
+ // This can be modified via `ErrorWidget.builder`
+ // ErrorWidget.builder = (details) => ErrorWidget(details.exception);
+ // cf https://docs.flutter.dev/testing/errors
+
+ LeakTracking.start();
+ FlutterMemoryAllocations.instance.addListener(
+ (event) => LeakTracking.dispatchObjectEvent(event.toMap()),
+ );
+ runApp(AvesApp(flavor: flavor, debugIntentData: debugIntentData));
+}