π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Warn for unawaited futures (#1559)
Neeraj Guptaf56191f70d47
diff --git a/analysis_options.yaml b/analysis_options.yamlindex cc6de6a004..cebeb1391e 100644--- a/analysis_options.yaml+++ b/analysis_options.yaml@@ -61,7 +61,7 @@ analyzer:cancel_subscriptions: error- unawaited_futures: ignore # convert to warning after fixing existing issues+ unawaited_futures: warning # convert to warning after fixing existing issuesinvalid_dependency: infouse_build_context_synchronously: ignore # experimental lint, requires many changesprefer_interpolation_to_compose_strings: ignore # later too many warningsdiff --git a/lib/core/configuration.dart b/lib/core/configuration.dartindex e005499300..785fab08f8 100644--- a/lib/core/configuration.dart+++ b/lib/core/configuration.dart@@ -171,7 +171,7 @@ class Configuration {SearchService.instance.clearCache();Bus.instance.fire(UserLoggedOutEvent());} else {- _preferences.setBool("auto_logout", true);+ await _preferences.setBool("auto_logout", true);}}diff --git a/lib/core/error-reporting/super_logging.dart b/lib/core/error-reporting/super_logging.dartindex a92decfb62..cc9c3122c3 100644--- a/lib/core/error-reporting/super_logging.dart+++ b/lib/core/error-reporting/super_logging.dart@@ -171,7 +171,7 @@ class SuperLogging {await setupLogDir();}if (sentryIsEnabled) {- setupSentry();+ setupSentry().ignore();}Logger.root.level = Level.ALL;@@ -266,7 +266,7 @@ class SuperLogging {// add error to sentry queueif (sentryIsEnabled && rec.error != null) {- _sendErrorToSentry(rec.error!, null);+ _sendErrorToSentry(rec.error!, null).ignore();}}@@ -303,7 +303,7 @@ class SuperLogging {static Future<void> setupSentry() async {await for (final error in sentryQueueControl.stream.asBroadcastStream()) {try {- Sentry.captureException(+ await Sentry.captureException(error,);} catch (e) {diff --git a/lib/main.dart b/lib/main.dartindex ef1870783b..1415ac4e9e 100644--- a/lib/main.dart+++ b/lib/main.dart@@ -65,8 +65,8 @@ void main() async {MediaKit.ensureInitialized();final savedThemeMode = await AdaptiveTheme.getThemeMode();await _runInForeground(savedThemeMode);- BackgroundFetch.registerHeadlessTask(_headlessTaskHandler);- FlutterDisplayMode.setHighRefreshRate();+ unawaited(BackgroundFetch.registerHeadlessTask(_headlessTaskHandler));+ FlutterDisplayMode.setHighRefreshRate().ignore();}Future<void> _runInForeground(AdaptiveThemeMode? savedThemeMode) async {@@ -129,7 +129,7 @@ Future<void> _runInBackground(String taskId) async {_scheduleSuicide(kBGTaskTimeout, taskId); // To prevent OS from punishing us}await _init(true, via: 'runViaBackgroundTask');- UpdateService.instance.showUpdateNotification();+ UpdateService.instance.showUpdateNotification().ignore();await _sync('bgSync');BackgroundFetch.finish(taskId);}@@ -158,7 +158,7 @@ Future<void> _init(bool isBackground, {String via = ''}) async {AppLifecycleService.instance.onAppInForeground('init via: $via');}// Start workers asynchronously. No need to wait for them to start- Computer.shared().turnOn(workersCount: 4, verbose: kDebugMode);+ Computer.shared().turnOn(workersCount: 4, verbose: kDebugMode).ignore();CryptoUtil.init();await NetworkClient.instance.init();await Configuration.instance.init();diff --git a/lib/models/search/search_types.dart b/lib/models/search/search_types.dartindex 189569e2ee..a8d00ee745 100644--- a/lib/models/search/search_types.dart+++ b/lib/models/search/search_types.dart@@ -181,7 +181,7 @@ extension SectionTypeExtensions on SectionType {switch (this) {case SectionType.contacts:return () async {- shareText(+ await shareText(S.of(context).shareTextRecommendUsingEnte,);};@@ -210,7 +210,7 @@ extension SectionTypeExtensions on SectionType {try {final Collection c =await CollectionsService.instance.createAlbum(text);- routeToPage(+ await routeToPage(context,CollectionPage(CollectionWithThumbnail(c, null)),);@@ -222,7 +222,7 @@ extension SectionTypeExtensions on SectionType {},);if (result is Exception) {- showGenericErrorDialog(context: context, error: result);+ await showGenericErrorDialog(context: context, error: result);}};default:diff --git a/lib/services/billing_service.dart b/lib/services/billing_service.dartindex 5b5c572580..d565149fcb 100644--- a/lib/services/billing_service.dart+++ b/lib/services/billing_service.dart@@ -184,7 +184,7 @@ class BillingService {try {final String jwtToken = await UserService.instance.getFamiliesToken();final bool familyExist = userDetails.isPartOfFamily();- Navigator.of(context).push(+ await Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) {return WebPage(@@ -196,7 +196,7 @@ class BillingService {);} catch (e) {await dialog.hide();- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}await dialog.hide();}diff --git a/lib/services/entity_service.dart b/lib/services/entity_service.dartindex a89b44f582..bc9d10b642 100644--- a/lib/services/entity_service.dart+++ b/lib/services/entity_service.dart@@ -163,7 +163,7 @@ class EntityService {encryptedKey = response.encryptedKey;header = response.header;await _prefs.setString(_getEntityKeyPrefix(type), encryptedKey);- _prefs.setString(_getEntityHeaderPrefix(type), header);+ await _prefs.setString(_getEntityHeaderPrefix(type), header);}final entityKey = CryptoUtil.decryptSync(Sodium.base642bin(encryptedKey),diff --git a/lib/services/hidden_service.dart b/lib/services/hidden_service.dartindex a90dbc0377..711b3af18c 100644--- a/lib/services/hidden_service.dart+++ b/lib/services/hidden_service.dart@@ -154,7 +154,7 @@ extension HiddenService on CollectionsService {} catch (e, s) {_logger.severe("Could not hide", e, s);await dialog.hide();- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);return false;} finally {await dialog.hide();diff --git a/lib/services/local_authentication_service.dart b/lib/services/local_authentication_service.dartindex 9544fb442d..98c029d0be 100644--- a/lib/services/local_authentication_service.dart+++ b/lib/services/local_authentication_service.dart@@ -1,3 +1,5 @@+import "dart:async";+import 'package:flutter/material.dart';import 'package:local_auth/local_auth.dart';import 'package:photos/core/configuration.dart';@@ -22,7 +24,7 @@ class LocalAuthenticationService {Configuration.instance.shouldShowLockScreen(),);if (!result) {- showToast(context, infoMessage);+ unawaited(showToast(context, infoMessage));return false;} else {return true;@@ -54,10 +56,12 @@ class LocalAuthenticationService {.setEnabled(Configuration.instance.shouldShowLockScreen());}} else {- showErrorDialog(- context,- errorDialogTitle,- errorDialogContent,+ unawaited(+ showErrorDialog(+ context,+ errorDialogTitle,+ errorDialogContent,+ ),);}return false;diff --git a/lib/services/user_service.dart b/lib/services/user_service.dartindex 954891fd30..f6810759d8 100644--- a/lib/services/user_service.dart+++ b/lib/services/user_service.dart@@ -338,7 +338,7 @@ class UserService {Widget page;final String twoFASessionID = response.data["twoFactorSessionID"];if (twoFASessionID.isNotEmpty) {- setTwoFactor(value: true);+ await setTwoFactor(value: true);page = TwoFactorAuthenticationPage(twoFASessionID);} else {await _saveConfiguration(response);@@ -354,7 +354,7 @@ class UserService {);}}- Navigator.of(context).pushAndRemoveUntil(+ await Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (BuildContext context) {return page;@@ -740,9 +740,10 @@ class UserService {);await dialog.hide();if (response.statusCode == 200) {- showShortToast(context, S.of(context).authenticationSuccessful);+ showShortToast(context, S.of(context).authenticationSuccessful)+ .ignore();await _saveConfiguration(response);- Navigator.of(context).pushAndRemoveUntil(+ await Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (BuildContext context) {return const PasswordReentryPage();@@ -755,8 +756,8 @@ class UserService {await dialog.hide();_logger.severe(e);if (e.response != null && e.response!.statusCode == 404) {- showToast(context, "Session expired");- Navigator.of(context).pushAndRemoveUntil(+ showToast(context, "Session expired").ignore();+ await Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (BuildContext context) {return const LoginPage();@@ -809,7 +810,7 @@ class UserService {} on DioError catch (e) {_logger.severe(e);if (e.response != null && e.response!.statusCode == 404) {- showToast(context, S.of(context).sessionExpired);+ showToast(context, S.of(context).sessionExpired).ignore();Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (BuildContext context) {@@ -959,7 +960,7 @@ class UserService {try {recoveryKey = await getOrCreateRecoveryKey(context);} catch (e) {- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);return false;}final dialog = createProgressDialog(context, S.of(context).verifying);diff --git a/lib/ui/account/delete_account_page.dart b/lib/ui/account/delete_account_page.dartindex 8d031deed7..f623df8b57 100644--- a/lib/ui/account/delete_account_page.dart+++ b/lib/ui/account/delete_account_page.dart@@ -289,7 +289,7 @@ class _DeleteAccountPageState extends State<DeleteAccountPage> {showShortToast(context, S.of(context).yourAccountHasBeenDeleted);} catch (e, s) {Logger("DeleteAccount").severe("failed to delete", e, s);- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}}diff --git a/lib/ui/account/password_entry_page.dart b/lib/ui/account/password_entry_page.dartindex 5da5cd03a7..48505da478 100644--- a/lib/ui/account/password_entry_page.dart+++ b/lib/ui/account/password_entry_page.dart@@ -404,7 +404,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {} catch (e, s) {_logger.severe(e, s);await dialog.hide();- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}}@@ -456,7 +456,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {} catch (e, s) {_logger.severe(e, s);await dialog.hide();- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}}@@ -481,7 +481,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {S.of(context).sorryWeCouldNotGenerateSecureKeysOnThisDevicennplease,);} else {- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}}}diff --git a/lib/ui/account/verify_recovery_page.dart b/lib/ui/account/verify_recovery_page.dartindex c22aee355d..619a9e0903 100644--- a/lib/ui/account/verify_recovery_page.dart+++ b/lib/ui/account/verify_recovery_page.dart@@ -109,7 +109,7 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {),);} catch (e) {- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);return;}}diff --git a/lib/ui/actions/collection/collection_file_actions.dart b/lib/ui/actions/collection/collection_file_actions.dartindex c46003b20b..c913943755 100644--- a/lib/ui/actions/collection/collection_file_actions.dart+++ b/lib/ui/actions/collection/collection_file_actions.dart@@ -73,7 +73,10 @@ extension CollectionFileActions on CollectionActions {);if (actionResult?.action != null &&actionResult!.action == ButtonAction.error) {- showGenericErrorDialog(context: bContext, error: actionResult.exception);+ await showGenericErrorDialog(+ context: bContext,+ error: actionResult.exception,+ );} else {selectedFiles.clearAll();}@@ -187,7 +190,7 @@ extension CollectionFileActions on CollectionActions {} catch (e, s) {logger.severe("Failed to add to album", e, s);await dialog?.hide();- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);rethrow;}}diff --git a/lib/ui/actions/collection/collection_sharing_actions.dart b/lib/ui/actions/collection/collection_sharing_actions.dartindex f4656fe153..9428c56da3 100644--- a/lib/ui/actions/collection/collection_sharing_actions.dart+++ b/lib/ui/actions/collection/collection_sharing_actions.dart@@ -52,7 +52,7 @@ class CollectionActions {_showUnSupportedAlert(context);} else {logger.severe("Failed to update shareUrl collection", e);- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}return false;}@@ -93,7 +93,10 @@ class CollectionActions {);if (actionResult?.action != null) {if (actionResult!.action == ButtonAction.error) {- showGenericErrorDialog(context: context, error: actionResult.exception);+ await showGenericErrorDialog(+ context: context,+ error: actionResult.exception,+ );}return actionResult.action == ButtonAction.first;} else {@@ -142,7 +145,7 @@ class CollectionActions {return collection;} catch (e, s) {dialog.hide();- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);logger.severe("Failing to create link for selected files", e, s);}return null;@@ -183,7 +186,10 @@ class CollectionActions {);if (actionResult?.action != null) {if (actionResult!.action == ButtonAction.error) {- showGenericErrorDialog(context: context, error: actionResult.exception);+ await showGenericErrorDialog(+ context: context,+ error: actionResult.exception,+ );}return actionResult.action == ButtonAction.first;}@@ -230,7 +236,7 @@ class CollectionActions {} catch (e) {await dialog?.hide();logger.severe("Failed to get public key", e);- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);return false;}// getPublicKey can return null when no user is associated with given@@ -272,7 +278,7 @@ class CollectionActions {_showUnSupportedAlert(context);} else {logger.severe("failed to share collection", e);- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}return false;}@@ -353,7 +359,10 @@ class CollectionActions {);if (actionResult?.action != null &&actionResult!.action == ButtonAction.error) {- showGenericErrorDialog(context: bContext, error: actionResult.exception);+ await showGenericErrorDialog(+ context: bContext,+ error: actionResult.exception,+ );return false;}if ((actionResult?.action != null) &&diff --git a/lib/ui/actions/file/file_actions.dart b/lib/ui/actions/file/file_actions.dartindex 695c534062..f8a0bcad90 100644--- a/lib/ui/actions/file/file_actions.dart+++ b/lib/ui/actions/file/file_actions.dart@@ -125,7 +125,10 @@ Future<void> showSingleFileDeleteSheet();if (actionResult?.action != null &&actionResult!.action == ButtonAction.error) {- showGenericErrorDialog(context: context, error: actionResult.exception);+ await showGenericErrorDialog(+ context: context,+ error: actionResult.exception,+ );}}diff --git a/lib/ui/collections/album/vertical_list.dart b/lib/ui/collections/album/vertical_list.dartindex c926c8b66d..8891cd76bb 100644--- a/lib/ui/collections/album/vertical_list.dart+++ b/lib/ui/collections/album/vertical_list.dart@@ -109,7 +109,7 @@ class AlbumVerticalListWidget extends StatelessWidget {textCapitalization: TextCapitalization.words,);if (result is Exception) {- showGenericErrorDialog(+ await showGenericErrorDialog(context: context,error: result,);@@ -311,7 +311,7 @@ class AlbumVerticalListWidget extends StatelessWidget {);return true;} catch (e) {- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);return false;}}@@ -334,7 +334,7 @@ class AlbumVerticalListWidget extends StatelessWidget {),);} else {- showGenericErrorDialog(context: context, error: result);+ await showGenericErrorDialog(context: context, error: result);_logger.severe("Cannot share collections owned by others");}}@@ -356,7 +356,7 @@ class AlbumVerticalListWidget extends StatelessWidget {showGenericErrorDialog(context: context,error: Exception("Can not share collection owned by others"),- );+ ).ignore();_logger.severe("Cannot share collections owned by others");}return Future.value(true);@@ -413,7 +413,7 @@ class AlbumVerticalListWidget extends StatelessWidget {} catch (e, s) {_logger.severe("Could not move to album", e, s);await dialog.hide();- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);return false;}}@@ -442,7 +442,7 @@ class AlbumVerticalListWidget extends StatelessWidget {} catch (e, s) {_logger.severe("Could not move to album", e, s);await dialog.hide();- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);return false;}}diff --git a/lib/ui/collections/new_album_icon.dart b/lib/ui/collections/new_album_icon.dartindex 966685cd1c..9ec8181432 100644--- a/lib/ui/collections/new_album_icon.dart+++ b/lib/ui/collections/new_album_icon.dart@@ -55,7 +55,7 @@ class NewAlbumIcon extends StatelessWidget {},);if (result is Exception) {- showGenericErrorDialog(context: context, error: result);+ await showGenericErrorDialog(context: context, error: result);}},);diff --git a/lib/ui/components/buttons/button_widget.dart b/lib/ui/components/buttons/button_widget.dartindex ed6e53165e..2d1b170fe1 100644--- a/lib/ui/components/buttons/button_widget.dart+++ b/lib/ui/components/buttons/button_widget.dart@@ -498,7 +498,7 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {} else if (exception != null) {//This is to show the execution was unsuccessful if the dialog is manually//closed before the execution completes.- showGenericErrorDialog(context: context, error: exception);+ showGenericErrorDialog(context: context, error: exception).ignore();}}}diff --git a/lib/ui/payment/payment_web_page.dart b/lib/ui/payment/payment_web_page.dartindex 5bba834d5d..e619bc0d8d 100644--- a/lib/ui/payment/payment_web_page.dart+++ b/lib/ui/payment/payment_web_page.dart@@ -190,7 +190,7 @@ class _PaymentWebPageState extends State<PaymentWebPage> {} else {// should never reach here_logger.severe("unexpected status", uri.toString());- showGenericErrorDialog(+ await showGenericErrorDialog(context: context,error: Exception("expected payment status $paymentStatus"),);diff --git a/lib/ui/payment/store_subscription_page.dart b/lib/ui/payment/store_subscription_page.dartindex abeeb8b12d..d0eca6c935 100644--- a/lib/ui/payment/store_subscription_page.dart+++ b/lib/ui/payment/store_subscription_page.dart@@ -528,7 +528,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {response.notFoundIDs.toString();_logger.severe(errMsg);await _dialog.hide();- showGenericErrorDialog(+ await showGenericErrorDialog(context: context,error: Exception(errMsg),);diff --git a/lib/ui/payment/stripe_subscription_page.dart b/lib/ui/payment/stripe_subscription_page.dartindex d7354ba22b..81b172bc43 100644--- a/lib/ui/payment/stripe_subscription_page.dart+++ b/lib/ui/payment/stripe_subscription_page.dart@@ -303,20 +303,22 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {await _launchStripePortal();break;case playStore:- launchUrlString(- "https://play.google.com/store/account/subscriptions?sku=" +- _currentSubscription!.productID +- "&package=io.ente.photos",+ unawaited(+ launchUrlString(+ "https://play.google.com/store/account/subscriptions?sku=" ++ _currentSubscription!.productID ++ "&package=io.ente.photos",+ ),);break;case appStore:- launchUrlString("https://apps.apple.com/account/billing");+ unawaited(launchUrlString("https://apps.apple.com/account/billing"));break;default:final String capitalizedWord = paymentProvider.isNotEmpty? '${paymentProvider[0].toUpperCase()}${paymentProvider.substring(1).toLowerCase()}': '';- showErrorDialog(+ await showErrorDialog(context,S.of(context).sorry,S.of(context).contactToManageSubscription(capitalizedWord),@@ -328,7 +330,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {await _dialog.show();try {final String url = await _billingService.getStripeCustomerPortalUrl();- Navigator.of(context).push(+ await Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) {return WebPage(S.of(context).paymentDetails, url);@@ -337,7 +339,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {).then((value) => onWebPaymentGoBack);} catch (e) {await _dialog.hide();- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}await _dialog.hide();}@@ -382,7 +384,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {confirmAction = choice!.action == ButtonAction.first;}if (confirmAction) {- toggleStripeSubscription(isRenewCancelled);+ await toggleStripeSubscription(isRenewCancelled);}},);@@ -398,11 +400,13 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {: await _billingService.cancelStripeSubscription();await _fetchSub();} catch (e) {- showShortToast(- context,- isAutoRenewDisabled- ? S.of(context).failedToRenew- : S.of(context).failedToCancel,+ unawaited(+ showShortToast(+ context,+ isAutoRenewDisabled+ ? S.of(context).failedToRenew+ : S.of(context).failedToCancel,+ ),);}await _dialog.hide();@@ -454,7 +458,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {if (!_isStripeSubscriber &&_hasActiveSubscription &&_currentSubscription!.productID != freeProductID) {- showErrorDialog(+ await showErrorDialog(context,S.of(context).sorry,S.of(context).cancelOtherSubscription(@@ -473,7 +477,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {"addOnBonus ${convertBytesToReadableFormat(addOnBonus)},""overshooting by ${convertBytesToReadableFormat(_userDetails.getFamilyOrPersonalUsage() - (plan.storage + addOnBonus))}",);- showErrorDialog(+ await showErrorDialog(context,S.of(context).sorry,S.of(context).youCannotDowngradeToThisPlan,@@ -495,7 +499,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {return;}}- Navigator.push(+ await Navigator.push(context,MaterialPageRoute(builder: (BuildContext context) {diff --git a/lib/ui/payment/view_add_on_widget.dart b/lib/ui/payment/view_add_on_widget.dartindex 5da9e71077..18c5c10d92 100644--- a/lib/ui/payment/view_add_on_widget.dart+++ b/lib/ui/payment/view_add_on_widget.dart@@ -33,7 +33,7 @@ class ViewAddOnButton extends StatelessWidget {singleBorderRadius: 4,alignCaptionedTextToLeft: true,onTap: () async {- routeToPage(context, AddOnPage(bonusData!));+ await routeToPage(context, AddOnPage(bonusData!));},),);diff --git a/lib/ui/settings/advanced_settings_screen.dart b/lib/ui/settings/advanced_settings_screen.dartindex e5cc0f7616..30b80c9813 100644--- a/lib/ui/settings/advanced_settings_screen.dart+++ b/lib/ui/settings/advanced_settings_screen.dart@@ -1,3 +1,5 @@+import "dart:async";+import 'package:flutter/material.dart';import "package:photos/core/error-reporting/super_logging.dart";import "package:photos/generated/l10n.dart";@@ -106,8 +108,10 @@ class _AdvancedSettingsScreenState extends State<AdvancedSettingsScreen> {value: () =>MemoriesService.instance.showMemories,onChanged: () async {- MemoriesService.instance.setShowMemories(- !MemoriesService.instance.showMemories,+ unawaited(+ MemoriesService.instance.setShowMemories(+ !MemoriesService.instance.showMemories,+ ),);},),diff --git a/lib/ui/settings/backup/backup_folder_selection_page.dart b/lib/ui/settings/backup/backup_folder_selection_page.dartindex 810e1ee13b..e55ab9a5bd 100644--- a/lib/ui/settings/backup/backup_folder_selection_page.dart+++ b/lib/ui/settings/backup/backup_folder_selection_page.dart@@ -232,7 +232,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {} catch (e, s) {_logger.severe("Failed to updated backup folder", e, s);await dialog.hide();- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}}diff --git a/lib/ui/settings/backup/backup_section_widget.dart b/lib/ui/settings/backup/backup_section_widget.dartindex 7b05da8bcd..60d144f994 100644--- a/lib/ui/settings/backup/backup_section_widget.dart+++ b/lib/ui/settings/backup/backup_section_widget.dart@@ -94,7 +94,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {try {status = await SyncService.instance.getBackupStatus();} catch (e) {- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);return;}@@ -128,7 +128,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {duplicates =await DeduplicationService.instance.getDuplicateFiles();} catch (e) {- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);return;}@@ -217,7 +217,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {),firstButtonLabel: S.of(context).rateUs,firstButtonOnTap: () async {- UpdateService.instance.launchReviewUrl();+ await UpdateService.instance.launchReviewUrl();},firstButtonType: ButtonType.primary,secondButtonLabel: S.of(context).ok,@@ -225,7 +225,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {showShortToast(context,S.of(context).remindToEmptyEnteTrash,- );+ ).ignore();},);}diff --git a/lib/ui/settings/debug_section_widget.dart b/lib/ui/settings/debug_section_widget.dartindex 7eb75baf5d..944a37120c 100644--- a/lib/ui/settings/debug_section_widget.dart+++ b/lib/ui/settings/debug_section_widget.dart@@ -50,7 +50,7 @@ class DebugSectionWidget extends StatelessWidget {trailingIconIsMuted: true,onTap: () async {await LocalSyncService.instance.resetLocalSync();- showShortToast(context, "Done");+ showShortToast(context, "Done").ignore();},),sectionOptionSpacing,@@ -63,8 +63,8 @@ class DebugSectionWidget extends StatelessWidget {trailingIconIsMuted: true,onTap: () async {await IgnoredFilesService.instance.reset();- SyncService.instance.sync();- showShortToast(context, "Done");+ SyncService.instance.sync().ignore();+ showShortToast(context, "Done").ignore();},),sectionOptionSpacing,diff --git a/lib/ui/settings/general_section_widget.dart b/lib/ui/settings/general_section_widget.dartindex 79bc755a5e..5094d26289 100644--- a/lib/ui/settings/general_section_widget.dart+++ b/lib/ui/settings/general_section_widget.dart@@ -68,7 +68,7 @@ class GeneralSectionWidget extends StatelessWidget {trailingIconIsMuted: true,onTap: () async {final locale = await getLocale();- routeToPage(+ await routeToPage(context,LanguageSelectorPage(appSupportedLocales,diff --git a/lib/ui/settings/security_section_widget.dart b/lib/ui/settings/security_section_widget.dartindex 7805167f94..1d2b9e916d 100644--- a/lib/ui/settings/security_section_widget.dart+++ b/lib/ui/settings/security_section_widget.dart@@ -279,7 +279,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {}await UserService.instance.updateEmailMFA(isEnabled);} catch (e) {- showToast(context, S.of(context).somethingWentWrong);+ showToast(context, S.of(context).somethingWentWrong).ignore();}}}diff --git a/lib/ui/sharing/manage_album_participant.dart b/lib/ui/sharing/manage_album_participant.dartindex 7c6f33d569..16b6bd070e 100644--- a/lib/ui/sharing/manage_album_participant.dart+++ b/lib/ui/sharing/manage_album_participant.dart@@ -132,7 +132,10 @@ class _ManageIndividualParticipantStateCollectionParticipantRole.viewer,);} catch (e) {- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(+ context: context,+ error: e,+ );}if (isConvertToViewSuccess && mounted) {// reset valuediff --git a/lib/ui/sharing/pickers/device_limit_picker_page.dart b/lib/ui/sharing/pickers/device_limit_picker_page.dartindex de409ad39b..66c08bde74 100644--- a/lib/ui/sharing/pickers/device_limit_picker_page.dart+++ b/lib/ui/sharing/pickers/device_limit_picker_page.dart@@ -137,7 +137,7 @@ class _ItemsWidgetState extends State<ItemsWidget> {try {await CollectionsService.instance.updateShareUrl(widget.collection, prop);} catch (e) {- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);rethrow;}}diff --git a/lib/ui/sharing/pickers/link_expiry_picker_page.dart b/lib/ui/sharing/pickers/link_expiry_picker_page.dartindex 0e04e1a7fd..544684023a 100644--- a/lib/ui/sharing/pickers/link_expiry_picker_page.dart+++ b/lib/ui/sharing/pickers/link_expiry_picker_page.dart@@ -180,7 +180,7 @@ class _ItemsWidgetState extends State<ItemsWidget> {try {await CollectionsService.instance.updateShareUrl(widget.collection, prop);} catch (e) {- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);rethrow;}}diff --git a/lib/ui/viewer/file/file_app_bar.dart b/lib/ui/viewer/file/file_app_bar.dartindex d52d8ed146..c5d7d84870 100644--- a/lib/ui/viewer/file/file_app_bar.dart+++ b/lib/ui/viewer/file/file_app_bar.dart@@ -257,15 +257,15 @@ class FileAppBarState extends State<FileAppBar> {},onSelected: (dynamic value) async {if (value == 1) {- _download(widget.file);+ await _download(widget.file);} else if (value == 2) {await _toggleFileArchiveStatus(widget.file);} else if (value == 3) {- _setAs(widget.file);+ await _setAs(widget.file);} else if (value == 4) {- _handleHideRequest(context);+ await _handleHideRequest(context);} else if (value == 5) {- _handleUnHideRequest(context);+ await _handleUnHideRequest(context);}},),@@ -371,7 +371,7 @@ class FileAppBarState extends State<FileAppBar> {} catch (e) {_logger.warning("Failed to save file", e);await dialog.hide();- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);} finally {PhotoManager.startChangeNotify();LocalSyncService.instance.checkAndSync().ignore();@@ -432,7 +432,7 @@ class FileAppBarState extends State<FileAppBar> {} catch (e) {dialog.hide();_logger.severe("Failed to use as", e);- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}}}diff --git a/lib/ui/viewer/file_details/favorite_widget.dart b/lib/ui/viewer/file_details/favorite_widget.dartindex 5e39b15108..4e3fb1b5f3 100644--- a/lib/ui/viewer/file_details/favorite_widget.dart+++ b/lib/ui/viewer/file_details/favorite_widget.dart@@ -1,3 +1,5 @@+import "dart:async";+import "package:flutter/material.dart";import "package:like_button/like_button.dart";import "package:logging/logging.dart";@@ -77,9 +79,11 @@ class _FavoriteWidgetState extends State<FavoriteWidget> {} catch (e, s) {_logger.severe(e, s);hasError = true;- showToast(- context,- S.of(context).sorryCouldNotRemoveFromFavorites,+ unawaited(+ showToast(+ context,+ S.of(context).sorryCouldNotRemoveFromFavorites,+ ),);}}diff --git a/lib/ui/viewer/gallery/empty_album_state.dart b/lib/ui/viewer/gallery/empty_album_state.dartindex 0ec5b07567..c90721a687 100644--- a/lib/ui/viewer/gallery/empty_album_state.dart+++ b/lib/ui/viewer/gallery/empty_album_state.dart@@ -31,7 +31,7 @@ class EmptyAlbumState extends StatelessWidget {try {await showAddPhotosSheet(context, c);} catch (e) {- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}},),diff --git a/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/lib/ui/viewer/gallery/gallery_app_bar_widget.dartindex a1dde81f14..21f2f862e7 100644--- a/lib/ui/viewer/gallery/gallery_app_bar_widget.dart+++ b/lib/ui/viewer/gallery/gallery_app_bar_widget.dart@@ -172,7 +172,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {},);if (result is Exception) {- showGenericErrorDialog(context: context, error: result);+ await showGenericErrorDialog(context: context, error: result);}}@@ -204,7 +204,10 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {);if (actionResult?.action != null && mounted) {if (actionResult!.action == ButtonAction.error) {- showGenericErrorDialog(context: context, error: actionResult.exception);+ await showGenericErrorDialog(+ context: context,+ error: actionResult.exception,+ );} else if (actionResult.action == ButtonAction.first) {Navigator.of(context).pop();}@@ -224,7 +227,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {.getBackupStatus(pathID: widget.deviceCollection!.id);} catch (e) {await dialog.hide();- showGenericErrorDialog(context: context, error: e);+ unawaited(showGenericErrorDialog(context: context, error: e));return;}@@ -664,7 +667,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {} catch (e, s) {_logger.severe("failed to trash collection", e, s);await dialog.hide();- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}} else {final bool result = await collectionActions.deleteCollectionSheet(@@ -691,7 +694,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {}} catch (e, s) {_logger.severe("failed to trash collection", e, s);- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}}@@ -726,7 +729,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {}} catch (e, s) {_logger.severe(e, s);- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}}@@ -736,7 +739,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {await showAddPhotosSheet(bContext, collection!);} catch (e, s) {_logger.severe(e, s);- showGenericErrorDialog(context: bContext, error: e);+ await showGenericErrorDialog(context: bContext, error: e);}}diff --git a/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart b/lib/ui/viewer/gallery/hooks/add_photos_sheet.dartindex f9db777a8d..9f7921760c 100644--- a/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart+++ b/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart@@ -205,7 +205,7 @@ class AddPhotosPhotoWidget extends StatelessWidget {if (e is StateError) {final PermissionState ps = await PhotoManager.requestPermissionExtend();if (ps != PermissionState.authorized && ps != PermissionState.limited) {- showChoiceDialog(+ await showChoiceDialog(context,title: context.l10n.grantPermission,body: context.l10n.pleaseGrantPermissions,diff --git a/lib/ui/viewer/location/location_screen.dart b/lib/ui/viewer/location/location_screen.dartindex 5ff279288f..ecdf902af2 100644--- a/lib/ui/viewer/location/location_screen.dart+++ b/lib/ui/viewer/location/location_screen.dart@@ -118,7 +118,7 @@ class LocationScreenPopUpMenu extends StatelessWidget {);Navigator.of(context).pop();} catch (e) {- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);}}},diff --git a/lib/utils/delete_file_util.dart b/lib/utils/delete_file_util.dartindex 1128887a20..76d74065f5 100644--- a/lib/utils/delete_file_util.dart+++ b/lib/utils/delete_file_util.dart@@ -102,7 +102,7 @@ Future<void> deleteFilesFromEverywhere(await FilesDB.instance.deleteMultipleUploadedFiles(fileIDs);} catch (e) {_logger.severe(e);- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);rethrow;}for (final collectionID in updatedCollectionIDs) {@@ -127,9 +127,9 @@ Future<void> deleteFilesFromEverywhere(),);if (hasLocalOnlyFiles && Platform.isAndroid) {- showShortToast(context, S.of(context).filesDeleted);+ await showShortToast(context, S.of(context).filesDeleted);} else {- showShortToast(context, S.of(context).movedToTrash);+ await showShortToast(context, S.of(context).movedToTrash);}}if (uploadedFilesToBeTrashed.isNotEmpty) {@@ -163,7 +163,7 @@ Future<void> deleteFilesFromRemoteOnly(await FilesDB.instance.deleteMultipleUploadedFiles(uploadedFileIDs);} catch (e, s) {_logger.severe("Failed to delete files from remote", e, s);- showGenericErrorDialog(context: context, error: e);+ await showGenericErrorDialog(context: context, error: e);rethrow;}for (final collectionID in updatedCollectionIDs) {@@ -626,7 +626,10 @@ Future<void> showDeleteSheet();if (actionResult?.action != null &&actionResult!.action == ButtonAction.error) {- showGenericErrorDialog(context: context, error: actionResult.exception);+ await showGenericErrorDialog(+ context: context,+ error: actionResult.exception,+ );} else {selectedFiles.clearAll();}diff --git a/lib/utils/file_util.dart b/lib/utils/file_util.dartindex 10d5bcd9a4..ff45dfcaf8 100644--- a/lib/utils/file_util.dart+++ b/lib/utils/file_util.dart@@ -204,7 +204,7 @@ Future<File?> _getLivePhotoFromServer(return needLiveVideo ? livePhoto.video : livePhoto.image;} catch (e, s) {_logger.warning("live photo get failed", e, s);- _livePhotoDownloadsTracker.remove(downloadID);+ await _livePhotoDownloadsTracker.remove(downloadID);return null;}}@@ -348,9 +348,9 @@ Future<Uint8List> compressThumbnail(Uint8List thumbnail) {Future<void> clearCache(EnteFile file) async {if (file.fileType == FileType.video) {- VideoCacheManager.instance.removeFile(file.downloadUrl);+ await VideoCacheManager.instance.removeFile(file.downloadUrl);} else {- DefaultCacheManager().removeFile(file.downloadUrl);+ await DefaultCacheManager().removeFile(file.downloadUrl);}final cachedThumbnail = File(Configuration.instance.getThumbnailCacheDirectory() +diff --git a/lib/utils/magic_util.dart b/lib/utils/magic_util.dartindex fc5fef9bcc..539ccf9e46 100644--- a/lib/utils/magic_util.dart+++ b/lib/utils/magic_util.dart@@ -1,3 +1,5 @@+import "dart:async";+import 'package:flutter/material.dart';import 'package:logging/logging.dart';import 'package:path/path.dart';@@ -134,7 +136,7 @@ Future<void> updateOrder();} catch (e, s) {_logger.severe("failed to update order", e, s);- showShortToast(context, S.of(context).somethingWentWrong);+ unawaited(showShortToast(context, S.of(context).somethingWentWrong));rethrow;}}@@ -160,7 +162,7 @@ Future<void> changeCoverPhoto();} catch (e, s) {_logger.severe("failed to update cover", e, s);- showShortToast(context, S.of(context).somethingWentWrong);+ unawaited(showShortToast(context, S.of(context).somethingWentWrong));rethrow;}}@@ -179,7 +181,7 @@ Future<bool> editTime();return true;} catch (e) {- showShortToast(context, S.of(context).somethingWentWrong);+ showShortToast(context, S.of(context).somethingWentWrong).ignore();return false;}}@@ -218,7 +220,7 @@ Future<void> editFilename();if (result is Exception) {_logger.severe("Failed to rename file");- showGenericErrorDialog(context: context, error: result);+ await showGenericErrorDialog(context: context, error: result);}}@@ -238,7 +240,7 @@ Future<bool> editFileCaption(return true;} catch (e) {if (context != null) {- showShortToast(context, S.of(context).somethingWentWrong);+ unawaited(showShortToast(context, S.of(context).somethingWentWrong));}return false;}@@ -265,7 +267,7 @@ Future<void> _updatePublicMetadata(await FileMagicService.instance.updatePublicMagicMetadata(files, update);if (context != null) {if (showDoneToast) {- showShortToast(context, S.of(context).done);+ await showShortToast(context, S.of(context).done);}await dialog?.hide();}