From fc8a4fc5b6b543de511e84adf371a92a98f802f4 Mon Sep 17 00:00:00 2001 From: Jay Gajjar Date: Sun, 3 Sep 2023 04:17:20 +0530 Subject: [PATCH] fix: `Don't use 'BuildContext's across async gaps.` (#1148) --- lib/ui/views/app_selector/app_selector_viewmodel.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ui/views/app_selector/app_selector_viewmodel.dart b/lib/ui/views/app_selector/app_selector_viewmodel.dart index 9075b2a31e..e3691bba31 100644 --- a/lib/ui/views/app_selector/app_selector_viewmodel.dart +++ b/lib/ui/views/app_selector/app_selector_viewmodel.dart @@ -90,10 +90,14 @@ class AppSelectorViewModel extends BaseViewModel { await DeviceApps.getApp(packageName, true) as ApplicationWithIcon?; if (app != null) { if (await checkSplitApk(packageName) && !isRooted) { - return showSelectFromStorageDialog(context); + if (context.mounted) { + return showSelectFromStorageDialog(context); + } } else if (!await checkSplitApk(packageName) || isRooted) { selectApp(app); - Navigator.pop(context); + if (context.mounted) { + Navigator.pop(context); + } } } }