FirebaseAuthenticationService class

Wraps the firebase auth functionality into a service

Constructors

FirebaseAuthenticationService({@Deprecated('Pass in the appleRedirectUri through the signInWithApple function') String? appleRedirectUri, @Deprecated('Pass in the appleClientId through the signInWithApple function') String? appleClientId, Logger? log})

Properties

authStateChanges Stream<User?>
Exposes the authStateChanges functionality.
no setter
currentUser User?
Returns the current logged in Firebase User
no setter
firebaseAuth → FirebaseAuth
final
hashCode int
The hash code for this object.
no setterinherited
hasUser bool
Returns true when a user has logged in or signed on this device
no setter
log → Logger?
An Instance of Logger that can be used to log out what's happening in the service
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
userToken Future<String?>?
Returns the latest userToken stored in the Firebase Auth lib
no setter

Methods

authenticateWithOtp(String otp) Future<FirebaseAuthenticationResult>
Authenticate the user using SMS code otp
createAccountWithEmail({required String email, required String password}) Future<FirebaseAuthenticationResult>
Uses createUserWithEmailAndPassword to sign up to the Firebase application
emailExists(String email) Future<bool>
Returns true when email has a user registered
generateNonce([int length = 32]) String
Generates a cryptographically secure random nonce, to be included in a credential request.
isAppleSignInAvailable() Future<bool>
loginAnonymously() Future<FirebaseAuthenticationResult>
Anonymous Login
loginWithEmail({required String email, required String password}) Future<FirebaseAuthenticationResult>
logout() Future
Sign out of the social accounts that have been used
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestVerificationCode({required String phoneNumber, void onVerificationCompleted(FirebaseAuthenticationResult authenticationResult)?, void onVerificationFailed(FirebaseAuthException exception)?, void onCodeSent(String verificationId)?, void onCodeTimeout(String verificationId)?, String? autoRetrievedSmsCodeForTesting, Duration timeout = const Duration(seconds: 30), int? forceResendingToken}) Future<void>
Request a SMS verification code for phoneNumber sign-in.
Send reset password link to email
sha256ofString(String input) String
Returns the sha256 hash of input in hex notation.
signInWithApple({required String? appleRedirectUri, required String? appleClientId, bool askForFullName = true}) Future<FirebaseAuthenticationResult>
Apple will reject your app if you ask for the name when you sign in, but do not use it in the app. To prevent this, set askForFullName to false.
signInWithFacebook({String? webLoginHint}) Future<FirebaseAuthenticationResult>
Authenticates a user through Firebase using Facebook Provider.
signInWithGoogle({String? webLoginHint}) Future<FirebaseAuthenticationResult>
Authenticates a user through Firebase using Google Provider.
signInWithPhoneNumber(String phoneNumber) Future<ConfirmationResult>
Phone Number Login
toString() String
A string representation of this object.
inherited
updateDisplayName(String displayName) Future
Update the displayName of the Firebase User
updateEmail(String email) Future
Update the email of the Firebase User
updatePassword(String password) Future
Update the password of the Firebase User
updatePhotoURL(String photoUrl) Future
Update the photoURL of the Firebase User
validatePassword(String password) Future
Validate the current password of the Firebase User
verifyOtp(ConfirmationResult confirmationResult, String otp) Future<FirebaseAuthenticationResult>
Verify SMS code using confirmationResult and otp

Operators

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