flutter_bugly icon indicating copy to clipboard operation
flutter_bugly copied to clipboard

Zone mismatch.

Open cjltgb520 opened this issue 2 years ago • 3 comments

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 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)

cjltgb520 avatar Oct 27 '23 03:10 cjltgb520

I have the same problem.

Howard2595 avatar Nov 16 '23 07:11 Howard2595

I have the same problem.

CatEatFishs avatar Dec 29 '23 09:12 CatEatFishs

I have the same problem.

herowws avatar Mar 04 '24 01:03 herowws