fixed some async gaps warnings
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
// ignore_for_file: use_build_context_synchronously
|
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
@@ -82,8 +81,11 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
// Call your AuthCubit or repository to refresh user/accounts data
|
// Call your AuthCubit or repository to refresh user/accounts data
|
||||||
await context.read<AuthCubit>().refreshUserData();
|
await context.read<AuthCubit>().refreshUserData();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (!context.mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
/*const*/ SnackBar(
|
SnackBar(
|
||||||
content: Text(AppLocalizations.of(context).failedToRefresh),
|
content: Text(AppLocalizations.of(context).failedToRefresh),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -168,6 +170,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final auth = LocalAuthentication();
|
final auth = LocalAuthentication();
|
||||||
final canCheck = await auth.canCheckBiometrics;
|
final canCheck = await auth.canCheckBiometrics;
|
||||||
|
if (!mounted) return;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
if (canCheck) {
|
if (canCheck) {
|
||||||
ok = await auth.authenticate(
|
ok = await auth.authenticate(
|
||||||
@@ -178,6 +181,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
await storage.write('biometric_enabled', 'true');
|
await storage.write('biometric_enabled', 'true');
|
||||||
}
|
}
|
||||||
await storage.write('biometric_prompt_shown', 'true');
|
await storage.write('biometric_prompt_shown', 'true');
|
||||||
|
if (!mounted) return;
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context).enable),
|
child: Text(AppLocalizations.of(context).enable),
|
||||||
|
Reference in New Issue
Block a user