runMain function About UI Root
Run application, init Hive, set urlStrategy, and demo data.
Create OverlaySupport and call AppRoot.
Implementation
Future<void> runMain() async {
httpTestHeader = {
'Content-type': 'application/json',
'Accept': 'application/json',
'api-key': '3.01567984187____',
};
//
// > hive init
//
await Hive.initFlutter('Ais3uson');
final openHttpBox = await Hive.openBox(hiveHttpCache);
usePathUrlStrategy();
GoRouter.optionURLReflectsImperativeAPIs = true;
runApp(OverlaySupport.global(
child: ProviderScope(
observers: [AppProviderObserver()],
overrides: [
hiveBox(hiveHttpCache).overrideWith((ref) => openHttpBox),
// stub data for demo mode and testing
httpClientProvider(demoWorkerKey().certBase64)
.overrideWithValue(getMockHttpClient()),
],
child: AppRoot(
lastRouteOrRoot:
locator<SharedPreferences>().getString(AppRouteObserver.name) ??
'/',
),
),
));
}