initialize method

Future<void> initialize({
  1. required AppInUse app,
})

Inicialización manual para controlar mejor el ciclo de vida

Implementation

Future<void> initialize({
  required AppInUse app,
}) async {
  logger.t("AppConfig Initialization");

  if (_isInitialized) return;
  _isInitialized = true;

  try {
    appInUse = app;
    _initCrashlytics();
    // _getAppInfo() does a Firestore round-trip and is only used by
    // selectRootPage() to detect outdated client builds — it does NOT
    // need to block the first frame. Fire it in the background so the
    // splash can show immediately; selectRootPage() falls through to
    // the home page if the data has not arrived yet.
    unawaited(_getAppInfo());
    await _loadPackageInfo();
    if (app == AppInUse.e) {
      defaultItemlistType = ItemlistType.readlist;
    }
  } catch (e) {
    logger.e(e.toString());
  }
}