Created
July 14, 2022 18:30
-
-
Save AbedElazizShe/b424e8dc6c151847fb684a99a607292f to your computer and use it in GitHub Desktop.
Core main is the entry point
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Custom main points to Core main | |
import 'package:core/main.dart' as entry; | |
import 'config/custom_configuration.dart'; | |
void main() => entry.main(configuration: CustomConfiguration()); | |
/// Core main | |
Future<void> main({AppConfiguration? configuration}) async { | |
final AppConfiguration config = configuration ?? DefaultConfiguration(); | |
Localization.init(); | |
BlocOverrides.runZoned( | |
() => runApp(MultiBlocProvider(providers: [ | |
BlocProvider(create: (_) => ArticlesCubit()), | |
if (config.blocs().isNotEmpty) ...config.blocs() | |
], child: AppConfigProvider(appConfig: config, child: const App()))), | |
blocObserver: CubitObserver(), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment