getFirestoreClient function

FirestoreClient getFirestoreClient({
  1. String? firebaseUsername,
  2. String? firebasePassword,
  3. App? app,
  4. FirestoreApiEndpoints? endpoints,
})

Implementation

FirestoreClient getFirestoreClient(
    {String? firebaseUsername,
    String? firebasePassword,
    App? app,
    FirestoreApiEndpoints? endpoints}) {
  var email = firebaseUsername ?? _getEnvKey(_emailEnvVars)!.trim();
  var password = firebasePassword ?? _getEnvKey(_passwordEnvVars)!;

  if (password.startsWith("base64:")) {
    password =
        const Utf8Decoder().convert(const Base64Decoder().convert(password, 7));
  }

  if (password.endsWith("\n")) {
    password = password.substring(0, password.length - 1);
  }

  return new FirestoreClient(email, password, app, endpoints: endpoints);
}