useFirestoreEmulator function

void useFirestoreEmulator(
  1. String host,
  2. int port
)

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) {
  final h = host.toNativeUtf8();
  try {
    final rc = fdbFsUseEmulator(h.cast(), port);
    if (rc != 0) {
      throw StateError('useFirestoreEmulator failed ($rc)');
    }
  } finally {
    calloc.free(h);
  }
}