authenticate method
- required String localizedReason,
- Iterable<
AuthMessages> authMessages = const <AuthMessages>[IOSAuthMessages(), AndroidAuthMessages(), WindowsAuthMessages()], - AuthenticationOptions options = const AuthenticationOptions(),
Authenticates the user with biometrics available on the device while also allowing the user to use device authentication - pin, pattern, passcode.
Returns true if the user successfully authenticated, false otherwise.
localizedReason
is the message to show to user while prompting them
for authentication. This is typically along the lines of: 'Authenticate
to access MyApp.'. This must not be empty.
Provide authMessages
if you want to
customize messages in the dialogs.
Provide options
for configuring further authentication related options.
Throws a PlatformException if there were technical problems with local authentication (e.g. lack of relevant hardware). This might throw PlatformException with error code otherOperatingSystem on the iOS simulator.
Implementation
Future<bool> authenticate(
{required String localizedReason,
Iterable<AuthMessages> authMessages = const <AuthMessages>[
IOSAuthMessages(),
AndroidAuthMessages(),
WindowsAuthMessages()
],
AuthenticationOptions options = const AuthenticationOptions()}) {
return LocalAuthPlatform.instance.authenticate(
localizedReason: localizedReason,
authMessages: authMessages,
options: options,
);
}