diff --git a/examples/flutter_todos/lib/bootstrap.dart b/examples/flutter_todos/lib/bootstrap.dart index 5b2af21241a..4822daab26e 100644 --- a/examples/flutter_todos/lib/bootstrap.dart +++ b/examples/flutter_todos/lib/bootstrap.dart @@ -1,7 +1,7 @@ -import 'dart:async'; import 'dart:developer'; import 'package:bloc/bloc.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_todos/app/app.dart'; import 'package:flutter_todos/app/app_bloc_observer.dart'; @@ -13,12 +13,14 @@ void bootstrap({required TodosApi todosApi}) { log(details.exceptionAsString(), stackTrace: details.stack); }; + PlatformDispatcher.instance.onError = (error, stack) { + log(error.toString(), stackTrace: stack); + return true; + }; + Bloc.observer = const AppBlocObserver(); final todosRepository = TodosRepository(todosApi: todosApi); - runZonedGuarded( - () => runApp(App(todosRepository: todosRepository)), - (error, stackTrace) => log(error.toString(), stackTrace: stackTrace), - ); + runApp(App(todosRepository: todosRepository)); }