initNamedApp function
void
initNamedApp({})
Creates a second app under name, beside the default one.
A product runs on it when given the name: initAuth(app: name), and the
same app: on each call after it. The Database needs no init of its own,
only a databaseUrl here. Remote Config and App Check run on the default
app only.
No Database keeps a disk cache, the default app's included: the SDK names the cache for the database host alone, and two Databases on one host cannot share it.
Throws StateError when the name is already taken.
Implementation
void initNamedApp({
required String name,
required String appId,
required String apiKey,
required String projectId,
String? databaseUrl,
String? storageBucket,
}) {
if (name.isEmpty) throw ArgumentError.value(name, 'name', 'is empty');
if (!hasFirebase) {
throw StateError(
'this build has no Firebase SDK — configure with FDB_WITH_FIREBASE=ON '
'and an SDK on CMAKE_PREFIX_PATH (or an emb augment)',
);
}
_createApp(name, appId, apiKey, projectId, databaseUrl, storageBucket);
}