initFirestore function
Prepares Firestore on an app: the default one, or the named one app.
initDatabase or initNamedApp must have made the app first.
Every call here takes an app the same way: the name initNamedApp was
given, or nothing for the default app. Deleting a named app aborts its
transactions, fails whatever else was pending on its Firestore with a
FirestoreException, and sends each of its listeners an error.
Implementation
void initFirestore({String? app}) {
ensureLibraryLoaded();
final rc = _onApp(app, fdbFsInit);
if (rc != 0) {
throw StateError(
rc != -1
? 'Firestore instance could not be created ($rc)'
: app == null || app.isEmpty
? 'initFirestore before initDatabase: there is no App yet'
: 'initFirestore on "$app", which is not an app — call '
'initNamedApp first',
);
}
}