initFunctions function

void initFunctions({
  1. String region = '',
})

Binds Functions to the app already initialized by initDatabase.

region selects a non-default region, as the other SDKs spell it (us-central1 and so on); empty means the default.

Implementation

void initFunctions({String region = ''}) {
  ensureLibraryLoaded();
  if (!hasFirebase) {
    throw StateError('this build has no Firebase SDK');
  }
  final r = region.toNativeUtf8();
  try {
    final rc = fdbFunctionsInit(r.cast());
    if (rc != 0) {
      throw StateError(
        rc == -1
            ? 'initFunctions before the Firebase app was initialized'
            : 'Functions instance could not be created ($rc)',
      );
    }
  } finally {
    calloc.free(r);
  }
}