init static method

dynamic init(
  1. VoidCallback runApp
)

init method wraps the runApp method.

Implementation

static init(VoidCallback runApp) {
  ErrorWidget.builder = (errorDetails) {
    ///Add Error widget
    return Container();
  };

  runZonedGuarded(() async {
    WidgetsFlutterBinding.ensureInitialized();
    FlutterError.onError = (details) {
      FlutterError.dumpErrorToConsole(details);
      kLog(details.stack.toString(),
          logStatus: LogStatus.ERROR, tag: initializerTag);
    };
    await _initServices();
    runApp();
  }, (error, stack) {
    kLog('runZonedGuarded: ${error.toString()}',
        logStatus: LogStatus.ERROR, tag: initializerTag);
  });
}