canAuthenticateWithBiometrics static method

Future<bool> canAuthenticateWithBiometrics()

Returns true if the device can use biometrics for authentication.

This is async because local_auth needs to query the platform.

Implementation

static Future<bool> canAuthenticateWithBiometrics() async {
  try {
    final bool canCheckBiometrics = await _authentication.canCheckBiometrics;
    final bool isDeviceSupported = await _authentication.isDeviceSupported();
    return canCheckBiometrics && isDeviceSupported;
  } catch (_) {
    // If anything goes wrong, assume biometrics can't be used.
    return false;
  }
}