initAsync method

  1. @override
Future<bool> initAsync()
override

Runs all the asynchronous operations necessary before the app can proceed.

Implementation

@override
Future<bool> initAsync() async {
  var init = true;
  try {
    if (v.App.hotReload) {
      _vw = createView();
      _vw?.con?.initApp();
    } else {
      // Initialize System Preferences
      await Prefs.init();
      // Collect installation & connectivity information
      await _app.initInternal();
//        // If not running on the Web.
//        if (!kIsWeb) {
      await v.App.getDeviceInfo();
//        }
      // Initiate multi-language translations.
      await v.I10n.initAsync();

      // Set theme using App's menu system if any theme was saved.
      v.App.setThemeData();

      init = await super.initAsync();

      if (init) {
        _vw = createView();
        // Supply the state object to the App object.
        init = _app.setAppState(_vw);
        if (init) {
          init = await _vw!.initAsync();
        }
        if (init) {
          _vw?.con?.initApp();
        }
      }
    }
  } catch (e) {
    init = false;
    v.App.isInit = false;
    rethrow;
  }
  return v.App.isInit = init;
}