diff --git a/lib/features/kcc/kcc_consent_page.dart b/lib/features/kcc/kcc_consent_page.dart index bdbdfea9..4d708b1a 100644 --- a/lib/features/kcc/kcc_consent_page.dart +++ b/lib/features/kcc/kcc_consent_page.dart @@ -21,7 +21,11 @@ class KccConsentPage extends HookConsumerWidget { return Scaffold( appBar: AppBar( leading: IconButton( - onPressed: () => Navigator.of(context, rootNavigator: true).pop(), + onPressed: () { + if (context.mounted) { + Navigator.of(context, rootNavigator: true).pop(); + } + }, icon: const Icon(Icons.close), ), ), diff --git a/lib/features/kcc/kcc_retrieval_page.dart b/lib/features/kcc/kcc_retrieval_page.dart index 3a287d68..fbf35556 100644 --- a/lib/features/kcc/kcc_retrieval_page.dart +++ b/lib/features/kcc/kcc_retrieval_page.dart @@ -70,8 +70,12 @@ class KccRetrievalPage extends HookConsumerWidget { ), ), NextButton( - onPressed: () => Navigator.of(context, rootNavigator: true) - .pop(credential.value.asData?.value), + onPressed: () { + if (context.mounted) { + Navigator.of(context, rootNavigator: true) + .pop(credential.value.asData?.value); + } + }, ), ], ),