PasscodeBiometricAuthUI class

UI handler for passcode and biometric authentication dialogs.

Manages displaying dialogs for passcode and biometric authentication, and handles configuration persistence via provided onRead and onWrite callbacks. It supports operations such as authenticating, creating a new passcode, changing an existing passcode, and removing a passcode.

Implementers

Constructors

PasscodeBiometricAuthUI.new({String prefix = 'PasscodeBiometricAuth', String sha256Passcode = '', String salt = '', bool isUseBiometric = false, bool forceCreatePasscode = true, String title = 'Passcode', CheckConfig checkConfig = const CheckConfig(), CreateConfig createConfig = const CreateConfig(), RepeatConfig repeatConfig = const RepeatConfig(), double blurSigma = 15, void onMaxRetriesExceeded()?, Future<bool> onForgotPasscode(BuildContext context, PasscodeBiometricAuthUI authUI)?, OnRead? onRead, OnWrite? onWrite, HapticFeedbackType hapticFeedbackType = HapticFeedbackType.lightImpact, Widget dialogBuilder(BuildContext context, String title, Widget content, List<Widget>? actions)?})
Creates a new instance of PasscodeBiometricAuthUI.

Properties

blurSigma double
Blur intensity for the background when dialogs are shown.
final
checkConfig CheckConfig
Configuration options for the passcode validation dialog.
final
createConfig CreateConfig
Configuration options for creating a new passcode.
final
dialogBuilder Widget Function(BuildContext context, String title, Widget content, List<Widget>? actions)?
Custom builder for dialog widgets.
final
forceCreatePasscode bool
Determines if the app must force the creation of a passcode when it is missing.
final
hapticFeedbackType → HapticFeedbackType
Type of haptic feedback for UI interactions.
final
hashCode int
The hash code for this object.
no setterinherited
isUseBiometric Future<bool>
Indicates if biometric authentication is enabled.
no setter
onForgotPasscode Future<bool> Function(BuildContext context)?
Callback invoked when "forgot your passcode" is selected.
latefinal
onMaxRetriesExceeded → void Function()?
Callback executed when the maximum retry attempt threshold is exceeded.
final
onRead OnRead?
Callback to read saved configuration from local storage.
final
onWrite OnWrite?
Callback to write configuration to local storage.
final
prefix String
Prefix used when storing configuration data.
final
repeatConfig RepeatConfig
Configuration options for confirming the newly created passcode.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
salt String
The salt used to enhance the passcode security. (Defaults to an empty string.)
final
sha256Passcode Future<String>
Retrieves the current passcode in SHA256 hash format.
no setter
title String
Title displayed across all dialogs.
final

Methods

authenticate(BuildContext context, {bool? forceCreatePasscode, bool? isUseBiometric}) Future<bool>
Authenticates the user with biometric and/or passcode verification.
authenticateWithBiometric() Future<bool>
Initiates biometric authentication using available device sensors.
authenticateWithPasscode(BuildContext context) Future<bool>
Displays the passcode input dialog for authentication.
changePasscode(BuildContext context) Future<bool>
Allows the user to change the current passcode.
isAvailablePasscode() FutureOr<bool>
Determines if a passcode has already been set.
isBiometricAvailable() Future<bool>
Checks if biometric authentication is available on this device.
isPasscodeAuthenticated(String code) Future<bool>
Validates the provided passcode by comparing its SHA256 hash.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removePasscode() Future<void>
Removes the stored passcode and related authentication configurations.
toString() String
A string representation of this object.
inherited
useBiometric(bool isUse) Future<void>
Updates the user's preference for biometric authentication.

Operators

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