canAuthenticate method

  1. @override
Future<CanAuthenticateResponse> canAuthenticate()
override

Returns whether this device supports biometric/secure storage or the reason CanAuthenticateResponse why it is not supported.

Implementation

@override
Future<CanAuthenticateResponse> canAuthenticate() async {
  if (kIsWeb) {
    return CanAuthenticateResponse.unsupported;
  }
  if (Platform.isAndroid ||
      Platform.isIOS ||
      Platform.isMacOS ||
      Platform.isLinux) {
    final response = await _channel.invokeMethod<String>('canAuthenticate');
    final ret = _canAuthenticateMapping[response];
    if (ret == null) {
      throw StateError('Invalid response from native platform. {$response}');
    }
    return ret;
  }
  return CanAuthenticateResponse.unsupported;
}