// Author: Hugo Pointcheval // Email: git@pcl.ovh // ----- // File: bootstrap.dart // Created Date: 19/08/2022 15:05:17 // Last Modified: 19/08/2022 15:21:47 // ----- // Copyright (c) 2022 import 'dart:async'; import 'package:example_router/core/utils/app_bloc_observer.dart'; import 'package:example_router/firebase_options.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; Future bootstrap(FutureOr Function() builder) async { await runZonedGuarded( () async { WidgetsFlutterBinding.ensureInitialized(); FlutterError.onError = (details) { debugPrint(details.toString()); }; await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); GoRouter.setUrlPathStrategy(UrlPathStrategy.path); Bloc.observer = AppBlocObserver(); runApp(await builder()); }, (error, stackTrace) => debugPrint(error.toString()), ); }