initializeApp method

void initializeApp(
  1. String token,
  2. BuildContext context, {
  3. BlocObserver? blocObserver,
  4. required bool pathUrlStrategyEnabled,
  5. required List<dynamic Function()> dependenciesInitializers,
  6. bool loadThemeFromLocalStorage = true,
})

Implementation

void initializeApp(
  String token,
  BuildContext context, {
  BlocObserver? blocObserver,
  required bool pathUrlStrategyEnabled,
  required List<Function()> dependenciesInitializers,
  bool loadThemeFromLocalStorage = true,
}) {
  _dependenciesInitializer
      .initialize(
        token,
        context,
        blocObserver: blocObserver,
        pathUrlStrategyEnabled: pathUrlStrategyEnabled,
        dependenciesInitializers: dependenciesInitializers,
        loadThemeFromLocalStorage: loadThemeFromLocalStorage,
      )
      .then(
        (res) => res.fold(
          (l) => emit(DesignFlowAppError(error: l.toString())),
          (r) => _customFontsService.fetchFonts(r.appProps.customFonts).then(
                (res) => emit(
                  DesignFlowAppLoaded(
                    token: token,
                    assetsMapData: r.assetsMapData,
                    initialTheme: r.initialTheme,
                    appProps: r.appProps,
                  ),
                ),
              ),
        ),
      );
}