24 lines
498 B
Dart
24 lines
498 B
Dart
import 'package:local_auth/local_auth.dart';
|
|||
|
|
|
||
|
|
class BiometricService {
|
||
|
|
static final _auth = LocalAuthentication();
|
||
|
|
|
||
|
|
static Future<bool> isAvailable() async {
|
||
|
|
try {
|
||
|
|
return await _auth.canCheckBiometrics || await _auth.isDeviceSupported();
|
||
|
|
} catch (_) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
static Future<bool> authenticate() async {
|
||
|
|
try {
|
||
|
|
return await _auth.authenticate(
|
||
|
|
localizedReason: 'Unlock DailyYou',
|
||
|
|
);
|
||
|
|
} catch (_) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|