在 main.dart 中调用 Bloc.observer 时遇到问题
Having trouble calling Bloc.observer in main.dart
当我在 main.dart 中调用 Bloc.observer 时,它不起作用
你可以运行它通过防区
Runs body in its own error zone.
Creates a new zone using Zone.fork based on zoneSpecification and zoneValues, then runs body in that zone and returns the result.
await runZonedGuarded(
() async {
await BlocOverrides.runZoned(
() async => runApp(MyApp()),
blocObserver: AppBlocObserver(),
);
},
(error, stackTrace) => log(error.toString(), stackTrace: stackTrace),
);
当我在 main.dart 中调用 Bloc.observer 时,它不起作用
你可以运行它通过防区
Runs body in its own error zone.
Creates a new zone using Zone.fork based on zoneSpecification and zoneValues, then runs body in that zone and returns the result.
await runZonedGuarded(
() async {
await BlocOverrides.runZoned(
() async => runApp(MyApp()),
blocObserver: AppBlocObserver(),
);
},
(error, stackTrace) => log(error.toString(), stackTrace: stackTrace),
);