@@ -70,8 +70,7 @@ class AuthenticatorImpl with WidgetsBindingObserver implements Authenticator {
70
70
final lastActive = await _repository.getPausedTimestamp ();
71
71
if (lastActive != null ) {
72
72
final now = DateTime .now ();
73
- if (now.millisecondsSinceEpoch - lastActive.millisecondsSinceEpoch >
74
- lockAfterDuration.inMilliseconds) {
73
+ if (now.millisecondsSinceEpoch - lastActive.millisecondsSinceEpoch > lockAfterDuration.inMilliseconds) {
75
74
_lockController.lock (
76
75
availableMethods: await getAvailableBiometricMethods (),
77
76
);
@@ -210,6 +209,8 @@ class AuthenticatorImpl with WidgetsBindingObserver implements Authenticator {
210
209
case BiometricType .iris:
211
210
methods.add (BiometricMethod .iris);
212
211
break ;
212
+ default :
213
+ break ;
213
214
}
214
215
}
215
216
return methods;
@@ -221,15 +222,13 @@ class AuthenticatorImpl with WidgetsBindingObserver implements Authenticator {
221
222
if (! isSupported) {
222
223
return const Unavailable (reason: LocalAuthFailure .notAvailable);
223
224
}
224
- final storedValue =
225
- await _repository.isBiometricAuthenticationEnabled (userId: userId);
225
+ final storedValue = await _repository.isBiometricAuthenticationEnabled (userId: userId);
226
226
return Available (isEnabled: storedValue ?? false );
227
227
}
228
228
229
229
@override
230
230
Future <bool > isPinAuthenticationEnabled () async {
231
- final storedValue =
232
- await _repository.isPinAuthenticationEnabled (userId: userId);
231
+ final storedValue = await _repository.isPinAuthenticationEnabled (userId: userId);
233
232
return storedValue ?? false ;
234
233
}
235
234
@@ -263,8 +262,7 @@ class AuthenticatorImpl with WidgetsBindingObserver implements Authenticator {
263
262
Future <Either <LocalAuthFailure , Unit >> unlockWithBiometrics ({
264
263
required String userFacingExplanation,
265
264
}) async {
266
- final biometricAvailability =
267
- await getBiometricAuthenticationAvailability ();
265
+ final biometricAvailability = await getBiometricAuthenticationAvailability ();
268
266
if (biometricAvailability is Available ) {
269
267
if (! biometricAvailability.isEnabled) {
270
268
_lockController.lock (availableMethods: const []);
@@ -277,7 +275,7 @@ class AuthenticatorImpl with WidgetsBindingObserver implements Authenticator {
277
275
try {
278
276
final isSuccessful = await _biometricAuth.authenticate (
279
277
localizedReason: userFacingExplanation,
280
- options: AuthenticationOptions (biometricOnly: true ),
278
+ options: const AuthenticationOptions (biometricOnly: true ),
281
279
);
282
280
if (isSuccessful) {
283
281
_lockController.unlock ();
@@ -304,11 +302,9 @@ class AuthenticatorImpl with WidgetsBindingObserver implements Authenticator {
304
302
}
305
303
306
304
Future <bool > _isLockedDueToTooManyAttempts () async {
307
- final failedAttemptsList =
308
- await _repository.getListOfFailedAttempts (userId: userId);
305
+ final failedAttemptsList = await _repository.getListOfFailedAttempts (userId: userId);
309
306
if (failedAttemptsList.length > maxRetries) {
310
- if (DateTime .now ().difference (failedAttemptsList.last) <
311
- lockedOutDuration) {
307
+ if (DateTime .now ().difference (failedAttemptsList.last) < lockedOutDuration) {
312
308
return true ;
313
309
}
314
310
}
@@ -323,9 +319,7 @@ class AuthenticatorImpl with WidgetsBindingObserver implements Authenticator {
323
319
final biometric = await getBiometricAuthenticationAvailability ();
324
320
if (biometric is Available ) {
325
321
_lockController.lock (
326
- availableMethods: biometric.isEnabled
327
- ? await getAvailableBiometricMethods ()
328
- : const [],
322
+ availableMethods: biometric.isEnabled ? await getAvailableBiometricMethods () : const [],
329
323
);
330
324
}
331
325
if (biometric is Unavailable ) {
0 commit comments