Skip to content

Commit

Permalink
fix: check context.mounted before exiting ModalFlow (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethan-tbd authored Jul 17, 2024
1 parent 7a8d0f7 commit d4bb030
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/features/kcc/kcc_consent_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
),
Expand Down
8 changes: 6 additions & 2 deletions lib/features/kcc/kcc_retrieval_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
},
),
],
),
Expand Down

0 comments on commit d4bb030

Please sign in to comment.