useAuthEmulator function

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

Prepares Auth on the shared App. initDatabase must have run first. Points Auth at a local emulator. Call after initAuth and before signing in — the SDK reconfigures the endpoint rather than migrating a session that already exists.

Implementation

void useAuthEmulator(String host, int port) {
  if (!hasFirebase) {
    throw StateError(
      'this build has no Firebase SDK — nothing to point at an '
      'emulator',
    );
  }
  final h = host.toNativeUtf8();
  try {
    final rc = fdbAuthUseEmulator(h.cast(), port);
    if (rc != 0) {
      throw StateError('useAuthEmulator failed ($rc)');
    }
  } finally {
    calloc.free(h);
  }
}