instanceFor method Null safety

FirebaseDatabase instanceFor(
  1. {required FirebaseApp app,
  2. String? databaseURL}
)

Returns an instance using a specified FirebaseApp.

Implementation

static FirebaseDatabase instanceFor({
  required FirebaseApp app,
  String? databaseURL,
}) {
  String cacheKey = '${app.name}|$databaseURL';
  if (_cachedInstances.containsKey(cacheKey)) {
    return _cachedInstances[cacheKey]!;
  }

  FirebaseDatabase newInstance =
      FirebaseDatabase._(app: app, databaseURL: databaseURL);
  _cachedInstances[cacheKey] = newInstance;

  return newInstance;
}