authenticate method

  1. @override
Future<bool> authenticate({
  1. required String localizedReason,
  2. required Iterable<AuthMessages> authMessages,
  3. AuthenticationOptions options = const AuthenticationOptions(),
})
override

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: 'Please scan your finger 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

@override
Future<bool> authenticate({
  required String localizedReason,
  required Iterable<AuthMessages> authMessages,
  AuthenticationOptions options = const AuthenticationOptions(),
}) async {
  assert(localizedReason.isNotEmpty);

  if (options.biometricOnly) {
    throw UnsupportedError(
        "Windows doesn't support the biometricOnly parameter.");
  }

  return _api.authenticate(localizedReason);
}