FirebaseAuthService class

AuthService on Firebase Auth. With anonymousWhenSignedOut (the SDK reads published data as an anonymous user), signing out or deleting the account signs in anonymously again; anonymous users read as signed out.

A guest session (signInAsGuest) is the anonymous user, marked as a guest by its uid in storage (so it survives reloads, as the anonymous user itself does).

Implemented types

Constructors

FirebaseAuthService(FirebaseAuth auth, {bool anonymousWhenSignedOut = true, bool? web, LocalStorage? storage})

Properties

anonymousWhenSignedOut → bool
final
auth → FirebaseAuth
final
currentUser → AppUser?
The signed-in user (maybe anonymous), or null.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
storage → LocalStorage?
Where the guest session's uid is kept (memory when null).
final
userChanges → Stream<AppUser?>
The user, on every sign-in, sign-out and profile change.
no setteroverride

Methods

deleteAccount() → Future<void>
Deletes the signed-in user's account.
override
Whether link is a sign-in link.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reauthenticate(String password) → Future<void>
Confirms the signed-in user's password (a recent sign-in, which changing the password and deleting the account need). Fails with wrong-password when it isn't theirs.
override
sendEmailVerification() → Future<void>
override
sendPasswordResetEmail(String email) → Future<void>
override
Emails email a sign-in link back to continueUrl.
override
signIn({required String email, required String password}) → Future<AppUser>
override
signInAsGuest() → Future<AppUser>
Starts a guest session: an anonymous user marked AppUser.isGuest (the one already signed in anonymously, when there is one). A signUp during it keeps its uid.
override
Signs in with a sign-in link sent to email.
override
signInWithProvider(AuthProviderKind provider) → Future<AppUser>
override
signOut() → Future<void>
Signs out (an implementation that reads published data as an anonymous user signs in anonymously again).
override
signUp({required String email, required String password, String displayName = ''}) → Future<AppUser>
override
toString() → String
A string representation of this object.
inherited
updatePassword(String password) → Future<void>
override
updateProfile({String? displayName, String? photoUrl}) → Future<void>
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

guestKey → const String