signInWithBiometric method
Implementation
@override
Future<Response<bool>> signInWithBiometric({
BiometricConfig? config,
}) async {
final response = Response<bool>();
final mConfig = config ?? const BiometricConfig();
try {
if (!await localAuth.isDeviceSupported()) {
return response.withException(
mConfig.deviceException,
status: Status.notSupported,
);
} else {
if (await localAuth.canCheckBiometrics) {
final authenticated = await localAuth.authenticate(
localizedReason: mConfig.localizedReason,
authMessages: mConfig.authMessages,
options: mConfig.options,
);
if (authenticated) {
return response.withData(true);
} else {
return response.withException(
mConfig.failureException,
status: Status.notFound,
);
}
} else {
return response.withException(
mConfig.checkingException,
status: Status.undetected,
);
}
}
} catch (_) {
return response.withException(_, status: Status.failure);
}
}