When both biometrics are enrolled i.e. face id and fingerprint, local auth shows both

521 Views Asked by At

I have a login page. User can login through face id or finger print. I am using local auth package 1.1.11 (because Biometrictype.fingerPrint and faceId works here after that it uses BiometricsType.weak and BiometricsType.Strong) to local perform authentication. I am facing an issue that when both biometrics are enrolled in my device i.e. face id and fingerprint, local auth shows both biometrics when i taped on fingerprint sensor or face id.

static Future<bool> authenticate() async {

List<BiometricType> availableBiometrics = await _auth.getAvailableBiometrics();

final isAvailable = await hasBiometrics();
if (!isAvailable) return false;

if (availableBiometrics.contains(BiometricType.fingerprint)) {
  try {
    return await _auth.authenticate(
      biometricOnly: true,
      stickyAuth: true,
      useErrorDialogs: true,
      localizedReason: 'Scan Fingerprint to Authenticate',
     
    );
  } on PlatformException catch (e) {
    debugPrint(e.toString());
    myToastError('Please add finger print first');
    return false;
  }
}
return Future.value(true);

}

static Future<bool> authenticateFaceId() async {

List<BiometricType> availableBiometrics = await _auth.getAvailableBiometrics();

final isAvailable = await hasBiometrics();
if (!isAvailable) return false;
if (availableBiometrics.contains(BiometricType.faceId)) {
  try {
    return await _auth.authenticate(
      biometricOnly: true,
      useErrorDialogs: false,
      sensitiveTransaction: false,
      stickyAuth: true,
      localizedReason: 'Scan Face to Authenticate',
      
    );
  } on PlatformException catch (e) {
    debugPrint(e.toString());
    myToastError('Please add face id first');
    return false;
  }
} else {
  return Future.value(false);
}

}

0

There are 0 best solutions below