useFirestoreEmulator function
Creates the Firestore instance on the shared firebase::App.
initDatabase must have run first — that is what creates the App, and the credential a signed-in user establishes travels with it. Points Firestore at a local emulator. Call after initFirestore and before the first operation: Firestore freezes its settings once the client starts, so a later call is refused.
Implementation
void useFirestoreEmulator(String host, int port, {String? app}) {
final h = host.toNativeUtf8();
try {
final rc = _onApp(app, (a) => fdbFsUseEmulator(a, h.cast(), port));
if (rc != 0) {
throw StateError('useFirestoreEmulator failed ($rc)');
}
} finally {
calloc.free(h);
}
}