canAuthenticate method
Returns whether this device supports biometric/secure storage or the reason CanAuthenticateResponse why it is not supported.
Implementation
@override
Future<CanAuthenticateResponse> canAuthenticate({
StorageFileInitOptions? options,
}) async {
if (kIsWeb) {
return CanAuthenticateResponse.unsupported;
}
if (Platform.isAndroid ||
Platform.isIOS ||
Platform.isMacOS ||
Platform.isLinux) {
final response = await _channel.invokeMethod<String>(
'canAuthenticate',
{
'options': options?.toJson() ?? StorageFileInitOptions().toJson(),
},
);
final ret = _canAuthenticateMapping[response];
if (ret == null) {
throw StateError('Invalid response from native platform. {$response}');
}
return ret;
}
return CanAuthenticateResponse.unsupported;
}