0

enter image description here

When I call Bloc.observer in main.dart, it doesn't work

1
  • Always post sinppets of your code, not images.
    – griffins
    Mar 26, 2022 at 6:11

1 Answer 1

1

You can run it through zone guarded

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.