authenticate method
Implementation
@override
Future<SecureAuthResult> authenticate({
required String reason,
bool biometricOnly = false,
}) async {
try {
final result = await methodChannel.invokeMethod<String>('authenticate', {
'reason': reason,
'biometricOnly': biometricOnly,
});
if (result == null) {
return SecureAuthResult.error;
}
switch (result) {
case 'success':
return SecureAuthResult.success;
case 'canceled':
return SecureAuthResult.canceled;
case 'notAvailable':
return SecureAuthResult.notAvailable;
case 'passcodeNotSet':
return SecureAuthResult.passcodeNotSet;
default:
return SecureAuthResult.error;
}
} on PlatformException catch (_) {
return SecureAuthResult.error;
}
}