======== Exception caught by Flutter framework =====================================================
The following assertion was thrown during runApp:
Zone mismatch.
The Flutter bindings were initialized in a different zone than is now being used. This will likely cause confusion and bugs as any zone-specific configuration will inconsistently use the configuration of the original binding initialization zone or this zone based on hard-to-predict factors such as which zone was active when a particular callback was set.
It is important to use the same zone when calling ensureInitialized on the binding as when calling runApp later.
To make this warning fatal, set BindingBase.debugZoneErrorsAreFatal to true before the bindings are initialized (i.e. as the first statement in void main() { }).
When the exception was thrown, this was the stack:
BindingBase.debugCheckZone. (package:flutter/src/foundation/binding.dart:503:29)
BindingBase.debugCheckZone (package:flutter/src/foundation/binding.dart:508:6)
runApp (package:flutter/src/widgets/binding.dart:1093:18)
main. (package:flutter_bugly_example/main.dart:7:43)
FlutterBugly.postCatchedException. (package:flutter_bugly/src/flutter_bugly.dart:101:15)
FlutterBugly.postCatchedException (package:flutter_bugly/src/flutter_bugly.dart:100:5)
main (package:flutter_bugly_example/main.dart:7:16)
_runMain. (dart:ui/hooks.dart:159:23)
_delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:296:19)
_RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)
(elided 4 frames from dart:async)
runapp 前面加上 WidgetsFlutterBinding.ensureInitialized(); 在flutter 3.10 及更高版本会报出异常
void main() { WidgetsFlutterBinding.ensureInitialized(); FlutterBugly.postCatchedException(() => runApp(MyApp())); }
======== Exception caught by Flutter framework ===================================================== The following assertion was thrown during runApp: Zone mismatch.
The Flutter bindings were initialized in a different zone than is now being used. This will likely cause confusion and bugs as any zone-specific configuration will inconsistently use the configuration of the original binding initialization zone or this zone based on hard-to-predict factors such as which zone was active when a particular callback was set. It is important to use the same zone when calling (package:flutter/src/foundation/binding.dart:503:29)
BindingBase.debugCheckZone (package:flutter/src/foundation/binding.dart:508:6)
runApp (package:flutter/src/widgets/binding.dart:1093:18)
main. (package:flutter_bugly_example/main.dart:7:43)
FlutterBugly.postCatchedException. (package:flutter_bugly/src/flutter_bugly.dart:101:15)
FlutterBugly.postCatchedException (package:flutter_bugly/src/flutter_bugly.dart:100:5)
main (package:flutter_bugly_example/main.dart:7:16)
_runMain. (dart:ui/hooks.dart:159:23)
_delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:296:19)
_RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)
(elided 4 frames from dart:async)
ensureInitialized
on the binding as when callingrunApp
later. To make this warning fatal, set BindingBase.debugZoneErrorsAreFatal to true before the bindings are initialized (i.e. as the first statement invoid main() { }
). When the exception was thrown, this was the stack: BindingBase.debugCheckZone.