Skip to content

Commit 22da7ce

Browse files
committed
chore: Now handling errors in EnableLocalAuthSettingsEntryWidget.
1 parent 041eb44 commit 22da7ce

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/pages/settings/entries/enable_local_auth.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:open_authenticator/model/app_unlock/methods/method.dart';
66
import 'package:open_authenticator/model/settings/app_unlock_method.dart';
77
import 'package:open_authenticator/pages/settings/entries/widgets.dart';
88
import 'package:open_authenticator/utils/local_authentication/local_authentication.dart';
9+
import 'package:open_authenticator/utils/result.dart';
910

1011
/// Allows to configure [enableLocalAuthSettingsEntryProvider].
1112
class EnableLocalAuthSettingsEntryWidget extends CheckboxSettingsEntryWidget<AppUnlockMethodSettingsEntry, String> {
@@ -33,7 +34,10 @@ class EnableLocalAuthSettingsEntryWidget extends CheckboxSettingsEntryWidget<App
3334
@override
3435
Future<void> changeValue(BuildContext context, WidgetRef ref, bool newValue) async {
3536
String newMethod = newValue ? LocalAuthenticationAppUnlockMethod.kMethodId : NoneAppUnlockMethod.kMethodId;
36-
ref.read(appUnlockMethodSettingsEntryProvider.notifier).changeValueIfUnlockSucceed(newMethod, context);
37+
Result result = await ref.read(appUnlockMethodSettingsEntryProvider.notifier).changeValueIfUnlockSucceed(newMethod, context);
38+
if (context.mounted && result is! ResultSuccess) {
39+
context.handleResult(result);
40+
}
3741
}
3842

3943
@override

0 commit comments

Comments
 (0)