instanceFor static method

FirebaseFunctions instanceFor({
  1. FirebaseApp? app,
  2. String? region,
})

Returns an instance using a specified FirebaseApp & region.

Implementation

static FirebaseFunctions instanceFor({FirebaseApp? app, String? region}) {
  app ??= Firebase.app();
  region ??= 'us-central1';
  String cachedKey = '${app.name}_$region';

  if (_cachedInstances.containsKey(cachedKey)) {
    return _cachedInstances[cachedKey]!;
  }

  FirebaseFunctions newInstance =
      FirebaseFunctions._(app: app, region: region);
  _cachedInstances[cachedKey] = newInstance;

  return newInstance;
}