setup static method

void setup({
  1. String? storagePath,
  2. Platform? platform,
  3. bool isolated = false,
  4. dynamic launchUrl(
    1. Uri url, {
    2. bool popup,
    })?,
  5. AuthHandler? authHandler,
  6. ApplicationVerifier? applicationVerifier,
  7. SmsRetriever? smsRetriever,
  8. Client? httpClient,
})

Initializes the pure dart firebase implementation.

On flutter, use the FirebaseDartFlutter.setup() method instead.

When storagePath is defined, persistent cache will be stored in files at that location. On web, local storage will be used instead and the value of storagePath is ignored. On non-web platforms, a memory cache will be used instead of a file cache when storagePath is null.

On android and ios apps, a platform should be specified containing some app specific properties. This is necessary for certain auth methods. On other platforms or when not using these auth methods, the platform argument can be omitted.

An authHandler can be spedified to handle auth requests with FirebaseAuth.signInWithRedirect and FirebaseAuth.signInWithPopup. When omitted, a default implementation will be used in a web context. On other platforms no default implementation is provided. On flutter, use the firebase_dart_flutter package with FirebaseDartFlutter.setup instead.

Several firebase methods might need to launch an external url. Set the launchUrl parameter to handle these. When omitted, a default implementation will be used in a web context. On flutter, use the firebase_dart_flutter package with FirebaseDartFlutter.setup instead.

When isolated is true, all operations will run in a separate isolate. Isolates are not supported on web.

A custom httpClient can be specified to handle all http requests. This can be usefull for testing purposes, but is generally unnecessary.

Implementation

static void setup(
    {String? storagePath,
    Platform? platform,
    bool isolated = false,
    Function(Uri url, {bool popup})? launchUrl,
    AuthHandler? authHandler,
    ApplicationVerifier? applicationVerifier,
    SmsRetriever? smsRetriever,
    http.Client? httpClient}) {
  baseUrl = Uri.base;

  setupPureDartImplementation(
    authHandler: authHandler ?? DefaultAuthHandler(),
    applicationVerifier:
        applicationVerifier ?? RecaptchaApplicationVerifier(),
    smsRetriever: smsRetriever ?? DummySmsRetriever(),
    launchUrl: launchUrl ?? _defaultLaunchUrl,
    platform: platform,
    httpClient: httpClient,
    isolated: isolated,
    storagePath: storagePath,
  );
}