SmartAuth class

Flutter package for listening SMS code on Android, suggesting phone number, email, saving a credential.

If you need pin code input like shown below, take a look at Pinput package, SmartAuth is already integrated into it and you can build highly customizable input, that your designers can't even draw in Figma 🤭 Note that only Android is supported, I faked other operating systems because other package is depended on this one and that package works on every system

Features:

  • Android Autofill
    • SMS Retriever API
    • SMS User Consent API
  • Showing Hint Dialog
  • Getting Saved Credential
  • Saving Credential
  • Deleting Credential

Constructors

SmartAuth()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

deleteCredential({required String id, String? accountType, String? name, String? password, String? profilePictureUri}) → Future<bool>
Deletes a credential that is no longer valid for signing into the app. More about this https://developers.google.com/android/reference/com/google/android/gms/auth/api/credentials/CredentialsApi?hl=en#save(com.google.android.gms.common.api.GoogleApiClient,%20com.google.android.gms.auth.api.credentials.Credential)
getAppSignature() → Future<String?>
This method outputs hash that is required for SMS Retriever API https://developers.google.com/identity/sms-retriever/overview?hl=en SMS must contain this hash at the end of the text Note that hash for debug and release if different
getCredential({String? accountType, String? serverClientId, String? idTokenNonce, bool? isIdTokenRequested, bool? isPasswordLoginSupported, bool showResolveDialog = false}) → Future<Credential?>
Tries to suggest a zero-click sign-in account. Only call this if your app does not currently know who is signed in. If zero-click suggestion fails app show dialog of credentials to choose from More about this https://developers.google.com/android/reference/com/google/android/gms/auth/api/credentials/CredentialsApi?hl=en#save(com.google.android.gms.common.api.GoogleApiClient,%20com.google.android.gms.auth.api.credentials.Credential)
getSmsCode({String matcher = _defaultCodeMatcher, String? senderPhoneNumber, bool useUserConsentApi = false}) → Future<SmsCodeResult>
Starts listening to SMS that contains the App signature getAppSignature in the text returns code if it matches with matcher More about SMS Retriever API https://developers.google.com/identity/sms-retriever/overview?hl=en
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeSmsListener() → Future<void>
Removes listener for getSmsCode
removeSmsRetrieverListener() → Future<bool>
Disposes getSmsCode if useUserConsentApi is false listener
removeSmsUserConsentListener() → Future<bool>
Disposes getSmsCode if useUserConsentApi is true listener
requestHint({bool? isEmailAddressIdentifierSupported, bool? isPhoneNumberIdentifierSupported, String? accountTypes, bool? showAddAccountButton, bool? showCancelButton, bool? isIdTokenRequested, String? idTokenNonce, String? serverClientId}) → Future<Credential?>
Opens dialog of user emails and/or phone numbers More about hint request https://developers.google.com/identity/smartlock-passwords/android/retrieve-hints More about parameters https://developers.google.com/android/reference/com/google/android/gms/auth/api/credentials/HintRequest.Builder
saveCredential({required String id, String? accountType, String? name, String? password, String? profilePictureUri}) → Future<bool>
Saves a credential that was used to sign in to the app. If disableAutoSignIn was previously called and the save operation succeeds, auto sign-in will be re-enabled if the user's settings permit this.
toString() → String
A string representation of this object.
inherited

Operators

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