diff --git a/lib/main.dart b/lib/main.dart index 78bb96ec..3fae1eac 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,10 +21,13 @@ import 'data/provider/snippet.dart'; import 'data/provider/virtual_keyboard.dart'; import 'locator.dart'; +late final DebugProvider _debug; + Future initApp() async { await initHive(); await setupLocator(); + _debug = locator(); locator().loadData(); locator().loadData(); @@ -51,8 +54,7 @@ void runInZone(dynamic Function() body) { // `setState() or markNeedsBuild() called during build` // error. Future.delayed(const Duration(milliseconds: 1), () { - final debugProvider = locator(); - debugProvider.addText(line); + _debug.addText(line); }); }, ); @@ -66,14 +68,13 @@ void runInZone(dynamic Function() body) { void onError(Object obj, StackTrace stack) { Analysis.recordException(obj); - final debugProvider = locator(); - debugProvider.addMultiline(obj, Colors.red); - debugProvider.addMultiline(stack, Colors.white); + _debug.addMultiline(obj, Colors.red); + _debug.addMultiline(stack, Colors.white); } Future main() async { - await initApp(); runInZone(() async { + await initApp(); runApp( MultiProvider( providers: [ diff --git a/pubspec.lock b/pubspec.lock index 5298dd6d..b8c1da3a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -746,10 +746,10 @@ packages: dependency: "direct main" description: name: share_plus - sha256: e387077716f80609bb979cd199331033326033ecd1c8f200a90c5f57b1c9f55e + sha256: "8c6892037b1824e2d7e8f59d54b3105932899008642e6372e5079c6939b4b625" url: "https://pub.flutter-io.cn" source: hosted - version: "6.3.0" + version: "6.3.1" share_plus_platform_interface: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 997afe17..65f9c1d6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -50,7 +50,7 @@ dependencies: r_upgrade: ^0.3.6 path_provider: ^2.0.9 easy_isolate: ^1.3.0 - share_plus: ^6.3.0 + share_plus: ^6.3.1 intl: ^0.17.0 share_plus_web: ^3.1.0 # xterm: ^3.4.1