init static method

Future<FirebaseApp> init({
  1. String? name,
  2. FirebaseOptions? options,
})

Initializes a new FirebaseApp instance by name and options and returns the created app. This method should be called before any usage of FlutterFire plugins. The default app instance cannot be initialized here and should be created using the platform Firebase integration.

remoteConfigFetchInterval is the interval that the app will fetch remote config data again. the unit of remoteConfigFetchInterval is minute. In debug mode, it can be set to 1. But in release mode, it must not be less than 15. If it is less than 15, then it will be escalated to 15.

Implementation

static Future<FirebaseApp> init({
  String? name,
  FirebaseOptions? options,
  // bool openProfile = false,
  // bool enableNotification = false,
  // String? firebaseServerToken,
  // Map<String, Map<dynamic, dynamic>>? settings,
  // Map<String, Map<String, String>>? translations,
}) async {
  // this.openProfile = openProfile;
  // this.enableNotification = enableNotification;
  // this.firebaseServerToken = firebaseServerToken;
  /// Initialize settings.
  ///
  /// Note. it must be called before firebase init.
  // if (settings != null) {
  //   _settings = mergeMap([_settings!, settings]);
  //   settingsChange.add(_settings);
  // }

  // if (translations != null) {
  //   translationsChange
  //       .add(translations); // Must be called before firebase init
  // }

  ///
  return Firebase.initializeApp(name: name, options: options)
      .then((firebaseApp) {
    FirebaseFirestore.instance.settings =
        const Settings(cacheSizeBytes: Settings.CACHE_SIZE_UNLIMITED);

    // FirebaseFirestore.instance.useFirestoreEmulator("local", 8080);

    // usersCol = FirebaseFirestore.instance.collection('users');
    // postsCol = FirebaseFirestore.instance.collection('posts');

    // initUser();
    // // initFirebaseMessaging();
    // listenSettingsChange();
    // listenTranslationsChange(translations);

    // /// Initialize or Re-initialize based on the setting's update.
    // settingsChange.listen((settings) {
    //   // debugPrint('settingsChange.listen() on GetxFire::init() $settings');

    //   // Initalize Algolia
    //   String? algoliaAppId = appSetting(ALGOLIA_APP_ID);
    //   String? apiKey = appSetting(ALGOLIA_ADMIN_API_KEY);
    //   if (algoliaAppId != null && apiKey != null) {
    //     algolia = Algolia.init(
    //       applicationId: algoliaAppId,
    //       apiKey: apiKey,
    //     );
    //   }
    // });

    // isFirebaseInitialized = true;
    // firebaseInitialized.add(isFirebaseInitialized);
    return firebaseApp;
  });
}