fixed some async gaps warnings

This commit is contained in:
asif
2025-08-29 22:35:51 +05:30
parent f7dd31fb93
commit 83ed973b44

View File

@@ -1,4 +1,3 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:developer';
import 'package:flutter/material.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
await context.read<AuthCubit>().refreshUserData();
} catch (e) {
if (!context.mounted) {
return;
}
ScaffoldMessenger.of(context).showSnackBar(
/*const*/ SnackBar(
SnackBar(
content: Text(AppLocalizations.of(context).failedToRefresh),
),
);
@@ -168,6 +170,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
onPressed: () async {
final auth = LocalAuthentication();
final canCheck = await auth.canCheckBiometrics;
if (!mounted) return;
bool ok = false;
if (canCheck) {
ok = await auth.authenticate(
@@ -178,6 +181,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
await storage.write('biometric_enabled', 'true');
}
await storage.write('biometric_prompt_shown', 'true');
if (!mounted) return;
Navigator.of(context).pop();
},
child: Text(AppLocalizations.of(context).enable),