request method
Authenticates the user with biometrics (faceId or touchId) if available on the device or by passcode as a fallback.
Returns a Future holding true, if the user successfully unlocked the device, false otherwise.
localizedReason
is the subtitle that is displayed on the native alert
that prompts user for authentication.
Throws an DeviceUnlockUnavailable if the Device does not have face, touch or pin security available.
Implementation
Future<bool> request({required String localizedReason}) async {
// ignore: unnecessary_null_comparison
assert(localizedReason != null);
try {
return await _channel.invokeMethod('request', localizedReason);
} on PlatformException catch (e) {
if (e.code == "DeviceUnlockUnavailable") {
throw DeviceUnlockUnavailable();
} else if (e.code == "RequestInProgress") {
throw RequestInProgress();
} else {
return throw e;
}
}
}