signUpAnonymous method

Future<FirebaseAccount> signUpAnonymous({
  1. bool autoRefresh = true,
})

Signs up to firebase as an anonymous user.

This will return a newly created FirebaseAccount with no login method attached. This means, you can only keep using this account by regularly refreshing the idToken. This happens automatically if autoRefresh is true or via FirebaseAccount.refresh().

If the request fails, an AuthError will be thrown. This also happens if anonymous logins have not been enabled in the firebase console.

If you ever want to "promote" an anonymous account to a normal account, you can do so by using FirebaseAccount.linkEmail() or FirebaseAccount.linkIdp() to add credentials to the account. This will preserve any data associated with this account.

Implementation

Future<FirebaseAccount> signUpAnonymous({
  bool autoRefresh = true,
}) async =>
    FirebaseAccount.apiCreate(
      api,
      await api.signUpAnonymous(const AnonymousSignInRequest()),
      autoRefresh: autoRefresh,
      locale: locale,
    );