瀏覽代碼

Merge branch 'fix_await_warnings' into onnx

vishnukvmd 1 年之前
父節點
當前提交
411ac66a91
共有 47 個文件被更改,包括 133 次插入116 次删除
  1. 9 5
      lib/main.dart
  2. 1 1
      lib/services/collections_service.dart
  3. 1 1
      lib/services/entity_service.dart
  4. 1 1
      lib/services/feature_flag_service.dart
  5. 2 1
      lib/services/hidden_service.dart
  6. 1 1
      lib/services/local_authentication_service.dart
  7. 3 3
      lib/services/local_sync_service.dart
  8. 1 1
      lib/services/notification_service.dart
  9. 1 0
      lib/services/push_service.dart
  10. 3 0
      lib/services/remote_sync_service.dart
  11. 1 0
      lib/services/sync_service.dart
  12. 1 0
      lib/services/update_service.dart
  13. 6 9
      lib/services/user_service.dart
  14. 2 0
      lib/ui/account/delete_account_page.dart
  15. 2 1
      lib/ui/account/login_page.dart
  16. 5 0
      lib/ui/account/password_entry_page.dart
  17. 1 0
      lib/ui/account/password_reentry_page.dart
  18. 1 0
      lib/ui/account/recovery_key_page.dart
  19. 2 0
      lib/ui/account/recovery_page.dart
  20. 5 4
      lib/ui/account/request_pwd_verification_page.dart
  21. 2 1
      lib/ui/account/sessions_page.dart
  22. 1 1
      lib/ui/account/two_factor_authentication_page.dart
  23. 1 1
      lib/ui/account/two_factor_setup_page.dart
  24. 1 0
      lib/ui/account/verify_recovery_page.dart
  25. 8 6
      lib/ui/actions/collection/collection_file_actions.dart
  26. 4 6
      lib/ui/actions/collection/collection_sharing_actions.dart
  27. 2 0
      lib/ui/actions/file/file_actions.dart
  28. 1 0
      lib/ui/collections/album/row_item.dart
  29. 1 1
      lib/ui/collections/album/vertical_list.dart
  30. 5 7
      lib/ui/payment/stripe_subscription_page.dart
  31. 1 1
      lib/ui/settings/backup/backup_section_widget.dart
  32. 2 2
      lib/ui/settings/debug_section_widget.dart
  33. 1 1
      lib/ui/settings/security_section_widget.dart
  34. 1 1
      lib/ui/tabs/shared/empty_state.dart
  35. 4 6
      lib/ui/viewer/actions/file_selection_actions_widget.dart
  36. 0 10
      lib/ui/viewer/file/zoomable_image.dart
  37. 3 5
      lib/ui/viewer/file_details/favorite_widget.dart
  38. 1 1
      lib/ui/viewer/gallery/gallery.dart
  39. 6 8
      lib/ui/viewer/gallery/gallery_app_bar_widget.dart
  40. 1 1
      lib/ui/viewer/gallery/hooks/add_photos_sheet.dart
  41. 1 0
      lib/ui/viewer/search/result/go_to_map_widget.dart
  42. 1 0
      lib/ui/viewer/search/tab_empty_state.dart
  43. 2 2
      lib/utils/delete_file_util.dart
  44. 1 0
      lib/utils/file_uploader.dart
  45. 4 3
      lib/utils/file_util.dart
  46. 6 6
      lib/utils/magic_util.dart
  47. 23 18
      lib/utils/toast_util.dart

+ 9 - 5
lib/main.dart

@@ -106,9 +106,11 @@ Future<void> _runBackgroundTask(String taskId, {String mode = 'normal'}) async {
     await _sync('bgTaskActiveProcess');
     await _sync('bgTaskActiveProcess');
     BackgroundFetch.finish(taskId);
     BackgroundFetch.finish(taskId);
   } else {
   } else {
+    // ignore: unawaited_futures
     _runWithLogs(
     _runWithLogs(
       () async {
       () async {
         _logger.info("Starting background task in $mode mode");
         _logger.info("Starting background task in $mode mode");
+        // ignore: unawaited_futures
         _runInBackground(taskId);
         _runInBackground(taskId);
       },
       },
       prefix: "[bg]",
       prefix: "[bg]",
@@ -152,7 +154,7 @@ Future<void> _init(bool isBackground, {String via = ''}) async {
   _logger.info("Initializing...  inBG =$isBackground via: $via");
   _logger.info("Initializing...  inBG =$isBackground via: $via");
   final SharedPreferences preferences = await SharedPreferences.getInstance();
   final SharedPreferences preferences = await SharedPreferences.getInstance();
   await _logFGHeartBeatInfo();
   await _logFGHeartBeatInfo();
-  _scheduleHeartBeat(preferences, isBackground);
+  unawaited(_scheduleHeartBeat(preferences, isBackground));
   AppLifecycleService.instance.init(preferences);
   AppLifecycleService.instance.init(preferences);
   if (isBackground) {
   if (isBackground) {
     AppLifecycleService.instance.onAppInBackground('init via: $via');
     AppLifecycleService.instance.onAppInBackground('init via: $via');
@@ -185,15 +187,15 @@ Future<void> _init(bool isBackground, {String via = ''}) async {
   SearchService.instance.init();
   SearchService.instance.init();
   StorageBonusService.instance.init(preferences);
   StorageBonusService.instance.init(preferences);
   if (Platform.isIOS) {
   if (Platform.isIOS) {
+    // ignore: unawaited_futures
     PushService.instance.init().then((_) {
     PushService.instance.init().then((_) {
       FirebaseMessaging.onBackgroundMessage(
       FirebaseMessaging.onBackgroundMessage(
         _firebaseMessagingBackgroundHandler,
         _firebaseMessagingBackgroundHandler,
       );
       );
     });
     });
   }
   }
-  FeatureFlagService.instance.init();
-  SemanticSearchService.instance.init(preferences);
-
+  unawaited(FeatureFlagService.instance.init());
+  unawaited(SemanticSearchService.instance.init(preferences));
   // Can not including existing tf/ml binaries as they are not being built
   // Can not including existing tf/ml binaries as they are not being built
   // from source.
   // from source.
   // See https://gitlab.com/fdroid/fdroiddata/-/merge_requests/12671#note_1294346819
   // See https://gitlab.com/fdroid/fdroiddata/-/merge_requests/12671#note_1294346819
@@ -242,6 +244,7 @@ Future<void> _scheduleHeartBeat(
     DateTime.now().microsecondsSinceEpoch,
     DateTime.now().microsecondsSinceEpoch,
   );
   );
   Future.delayed(kHeartBeatFrequency, () async {
   Future.delayed(kHeartBeatFrequency, () async {
+    // ignore: unawaited_futures
     _scheduleHeartBeat(prefs, isBackground);
     _scheduleHeartBeat(prefs, isBackground);
   });
   });
 }
 }
@@ -281,7 +284,7 @@ Future<void> _killBGTask([String? taskId]) async {
     DateTime.now().microsecondsSinceEpoch,
     DateTime.now().microsecondsSinceEpoch,
   );
   );
   final prefs = await SharedPreferences.getInstance();
   final prefs = await SharedPreferences.getInstance();
-  prefs.remove(kLastBGTaskHeartBeatTime);
+  await prefs.remove(kLastBGTaskHeartBeatTime);
   if (taskId != null) {
   if (taskId != null) {
     BackgroundFetch.finish(taskId);
     BackgroundFetch.finish(taskId);
   }
   }
@@ -299,6 +302,7 @@ Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
     }
     }
   } else {
   } else {
     // App is dead
     // App is dead
+    // ignore: unawaited_futures
     _runWithLogs(
     _runWithLogs(
       () async {
       () async {
         _logger.info("Background push received");
         _logger.info("Background push received");

+ 1 - 1
lib/services/collections_service.dart

@@ -147,7 +147,7 @@ class CollectionsService {
       );
       );
     }
     }
     await _updateDB(updatedCollections);
     await _updateDB(updatedCollections);
-    _prefs.setInt(_collectionsSyncTimeKey, maxUpdationTime);
+    await _prefs.setInt(_collectionsSyncTimeKey, maxUpdationTime);
     watch.logAndReset("till DB insertion ${updatedCollections.length}");
     watch.logAndReset("till DB insertion ${updatedCollections.length}");
     for (final collection in fetchedCollections) {
     for (final collection in fetchedCollections) {
       _cacheLocalPathAndCollection(collection);
       _cacheLocalPathAndCollection(collection);

+ 1 - 1
lib/services/entity_service.dart

@@ -142,7 +142,7 @@ class EntityService {
         await _db.upsertEntities(entities);
         await _db.upsertEntities(entities);
       }
       }
     }
     }
-    _prefs.setInt(_getEntityLastSyncTimePrefix(type), maxSyncTime);
+    await _prefs.setInt(_getEntityLastSyncTimePrefix(type), maxSyncTime);
     if (hasMoreItems) {
     if (hasMoreItems) {
       _logger.info("Diff limit reached, pulling again");
       _logger.info("Diff limit reached, pulling again");
       await _remoteToLocalSync(type);
       await _remoteToLocalSync(type);

+ 1 - 1
lib/services/feature_flag_service.dart

@@ -83,7 +83,7 @@ class FeatureFlagService {
           .getDio()
           .getDio()
           .get("https://static.ente.io/feature_flags.json");
           .get("https://static.ente.io/feature_flags.json");
       final flagsResponse = FeatureFlags.fromMap(response.data);
       final flagsResponse = FeatureFlags.fromMap(response.data);
-      _prefs.setString(_featureFlagsKey, flagsResponse.toJson());
+      await _prefs.setString(_featureFlagsKey, flagsResponse.toJson());
       _featureFlags = flagsResponse;
       _featureFlags = flagsResponse;
     } catch (e) {
     } catch (e) {
       _logger.severe("Failed to sync feature flags ", e);
       _logger.severe("Failed to sync feature flags ", e);

+ 2 - 1
lib/services/hidden_service.dart

@@ -1,3 +1,4 @@
+import "dart:async";
 import 'dart:convert';
 import 'dart:convert';
 import 'dart:typed_data';
 import 'dart:typed_data';
 
 
@@ -149,7 +150,7 @@ extension HiddenService on CollectionsService {
       await dialog.hide();
       await dialog.hide();
     } on AssertionError catch (e) {
     } on AssertionError catch (e) {
       await dialog.hide();
       await dialog.hide();
-      showErrorDialog(context, "Oops", e.message as String);
+      unawaited(showErrorDialog(context, "Oops", e.message as String));
       return false;
       return false;
     } catch (e, s) {
     } catch (e, s) {
       _logger.severe("Could not hide", e, s);
       _logger.severe("Could not hide", e, s);

+ 1 - 1
lib/services/local_authentication_service.dart

@@ -24,7 +24,7 @@ class LocalAuthenticationService {
         Configuration.instance.shouldShowLockScreen(),
         Configuration.instance.shouldShowLockScreen(),
       );
       );
       if (!result) {
       if (!result) {
-        unawaited(showToast(context, infoMessage));
+        showToast(context, infoMessage);
         return false;
         return false;
       } else {
       } else {
         return true;
         return true;

+ 3 - 3
lib/services/local_sync_service.dart

@@ -352,7 +352,7 @@ class LocalSyncService {
     PhotoManager.addChangeCallback((value) async {
     PhotoManager.addChangeCallback((value) async {
       _logger.info("Something changed on disk");
       _logger.info("Something changed on disk");
       _changeCallbackDebouncer.run(() async {
       _changeCallbackDebouncer.run(() async {
-        checkAndSync();
+        unawaited(checkAndSync());
       });
       });
     });
     });
     PhotoManager.startChangeNotify();
     PhotoManager.startChangeNotify();
@@ -363,9 +363,9 @@ class LocalSyncService {
       await _existingSync!.future;
       await _existingSync!.future;
     }
     }
     if (hasGrantedLimitedPermissions()) {
     if (hasGrantedLimitedPermissions()) {
-      syncAll();
+      unawaited(syncAll());
     } else {
     } else {
-      sync().then((value) => _refreshDeviceFolderCountAndCover());
+      unawaited(sync().then((value) => _refreshDeviceFolderCountAndCover()));
     }
     }
   }
   }
 }
 }

+ 1 - 1
lib/services/notification_service.dart

@@ -75,7 +75,7 @@ class NotificationService {
           ?.requestPermission();
           ?.requestPermission();
     }
     }
     if (result != null) {
     if (result != null) {
-      _preferences.setBool(keyGrantedNotificationPermission, result);
+      await _preferences.setBool(keyGrantedNotificationPermission, result);
     }
     }
   }
   }
 
 

+ 1 - 0
lib/services/push_service.dart

@@ -35,6 +35,7 @@ class PushService {
         await _configurePushToken();
         await _configurePushToken();
       } else {
       } else {
         Bus.instance.on<SignedInEvent>().listen((_) async {
         Bus.instance.on<SignedInEvent>().listen((_) async {
+          // ignore: unawaited_futures
           _configurePushToken();
           _configurePushToken();
         });
         });
       }
       }

+ 3 - 0
lib/services/remote_sync_service.dart

@@ -74,6 +74,7 @@ class RemoteSyncService {
     Bus.instance.on<LocalPhotosUpdatedEvent>().listen((event) async {
     Bus.instance.on<LocalPhotosUpdatedEvent>().listen((event) async {
       if (event.type == EventType.addedOrUpdated) {
       if (event.type == EventType.addedOrUpdated) {
         if (_existingSync == null) {
         if (_existingSync == null) {
+          // ignore: unawaited_futures
           sync();
           sync();
         }
         }
       }
       }
@@ -141,6 +142,7 @@ class RemoteSyncService {
         if (hasMoreFilesToBackup && !_shouldThrottleSync()) {
         if (hasMoreFilesToBackup && !_shouldThrottleSync()) {
           // Skipping a resync to ensure that files that were ignored in this
           // Skipping a resync to ensure that files that were ignored in this
           // session are not processed now
           // session are not processed now
+          // ignore: unawaited_futures
           sync();
           sync();
         } else {
         } else {
           _logger.info("Fire backup completed event");
           _logger.info("Fire backup completed event");
@@ -959,6 +961,7 @@ class RemoteSyncService {
           'creating notification for ${collection?.displayName} '
           'creating notification for ${collection?.displayName} '
           'shared: $sharedFilesIDs, collected: $collectedFilesIDs files',
           'shared: $sharedFilesIDs, collected: $collectedFilesIDs files',
         );
         );
+        // ignore: unawaited_futures
         NotificationService.instance.showNotification(
         NotificationService.instance.showNotification(
           collection!.displayName,
           collection!.displayName,
           totalCount.toString() + " new 📸",
           totalCount.toString() + " new 📸",

+ 1 - 0
lib/services/sync_service.dart

@@ -240,6 +240,7 @@ class SyncService {
     final now = DateTime.now().microsecondsSinceEpoch;
     final now = DateTime.now().microsecondsSinceEpoch;
     if ((now - lastNotificationShownTime) > microSecondsInDay) {
     if ((now - lastNotificationShownTime) > microSecondsInDay) {
       await _prefs.setInt(kLastStorageLimitExceededNotificationPushTime, now);
       await _prefs.setInt(kLastStorageLimitExceededNotificationPushTime, now);
+      // ignore: unawaited_futures
       NotificationService.instance.showNotification(
       NotificationService.instance.showNotification(
         "Storage limit exceeded",
         "Storage limit exceeded",
         "Sorry, we had to pause your backups",
         "Sorry, we had to pause your backups",

+ 1 - 0
lib/services/update_service.dart

@@ -86,6 +86,7 @@ class UpdateService {
     if (shouldUpdate &&
     if (shouldUpdate &&
         hasBeen3DaysSinceLastNotification &&
         hasBeen3DaysSinceLastNotification &&
         _latestVersion!.shouldNotify) {
         _latestVersion!.shouldNotify) {
+      // ignore: unawaited_futures
       NotificationService.instance.showNotification(
       NotificationService.instance.showNotification(
         "Update available",
         "Update available",
         "Click to install our best version yet",
         "Click to install our best version yet",

+ 6 - 9
lib/services/user_service.dart

@@ -740,8 +740,7 @@ class UserService {
       );
       );
       await dialog.hide();
       await dialog.hide();
       if (response.statusCode == 200) {
       if (response.statusCode == 200) {
-        showShortToast(context, S.of(context).authenticationSuccessful)
-            .ignore();
+        showShortToast(context, S.of(context).authenticationSuccessful);
         await _saveConfiguration(response);
         await _saveConfiguration(response);
         await Navigator.of(context).pushAndRemoveUntil(
         await Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
           MaterialPageRoute(
@@ -756,7 +755,7 @@ class UserService {
       await dialog.hide();
       await dialog.hide();
       _logger.severe(e);
       _logger.severe(e);
       if (e.response != null && e.response!.statusCode == 404) {
       if (e.response != null && e.response!.statusCode == 404) {
-        showToast(context, "Session expired").ignore();
+        showToast(context, "Session expired");
         await Navigator.of(context).pushAndRemoveUntil(
         await Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
           MaterialPageRoute(
             builder: (BuildContext context) {
             builder: (BuildContext context) {
@@ -810,7 +809,7 @@ class UserService {
     } on DioError catch (e) {
     } on DioError catch (e) {
       _logger.severe(e);
       _logger.severe(e);
       if (e.response != null && e.response!.statusCode == 404) {
       if (e.response != null && e.response!.statusCode == 404) {
-        showToast(context, S.of(context).sessionExpired).ignore();
+        showToast(context, S.of(context).sessionExpired);
         Navigator.of(context).pushAndRemoveUntil(
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
           MaterialPageRoute(
             builder: (BuildContext context) {
             builder: (BuildContext context) {
@@ -1016,11 +1015,9 @@ class UserService {
       );
       );
       await dialog.hide();
       await dialog.hide();
       Bus.instance.fire(TwoFactorStatusChangeEvent(false));
       Bus.instance.fire(TwoFactorStatusChangeEvent(false));
-      unawaited(
-        showShortToast(
-          context,
-          S.of(context).twofactorAuthenticationHasBeenDisabled,
-        ),
+      showShortToast(
+        context,
+        S.of(context).twofactorAuthenticationHasBeenDisabled,
       );
       );
     } catch (e) {
     } catch (e) {
       await dialog.hide();
       await dialog.hide();

+ 2 - 0
lib/ui/account/delete_account_page.dart

@@ -1,3 +1,4 @@
+import "dart:async";
 import 'dart:convert';
 import 'dart:convert';
 
 
 import "package:dropdown_button2/dropdown_button2.dart";
 import "package:dropdown_button2/dropdown_button2.dart";
@@ -344,6 +345,7 @@ class _DeleteAccountPageState extends State<DeleteAccountPage> {
       ],
       ],
     );
     );
 
 
+    // ignore: unawaited_futures
     showDialog(
     showDialog(
       context: context,
       context: context,
       builder: (BuildContext context) {
       builder: (BuildContext context) {

+ 2 - 1
lib/ui/account/login_page.dart

@@ -68,7 +68,7 @@ class _LoginPageState extends State<LoginPage> {
         isFormValid: _emailIsValid,
         isFormValid: _emailIsValid,
         buttonText: S.of(context).logInLabel,
         buttonText: S.of(context).logInLabel,
         onPressedFunction: () async {
         onPressedFunction: () async {
-          UserService.instance.setEmail(_email!);
+          await UserService.instance.setEmail(_email!);
           SrpAttributes? attr;
           SrpAttributes? attr;
           bool isEmailVerificationEnabled = true;
           bool isEmailVerificationEnabled = true;
           try {
           try {
@@ -80,6 +80,7 @@ class _LoginPageState extends State<LoginPage> {
             }
             }
           }
           }
           if (attr != null && !isEmailVerificationEnabled) {
           if (attr != null && !isEmailVerificationEnabled) {
+            // ignore: unawaited_futures
             Navigator.of(context).push(
             Navigator.of(context).push(
               MaterialPageRoute(
               MaterialPageRoute(
                 builder: (BuildContext context) {
                 builder: (BuildContext context) {

+ 5 - 0
lib/ui/account/password_entry_page.dart

@@ -1,3 +1,5 @@
+import "dart:async";
+
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter/services.dart';
 import 'package:logging/logging.dart';
 import 'package:logging/logging.dart';
@@ -445,6 +447,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
           await dialog.hide();
           await dialog.hide();
           Configuration.instance.setVolatilePassword(null);
           Configuration.instance.setVolatilePassword(null);
           Bus.instance.fire(AccountConfiguredEvent());
           Bus.instance.fire(AccountConfiguredEvent());
+          // ignore: unawaited_futures
           Navigator.of(context).pushAndRemoveUntil(
           Navigator.of(context).pushAndRemoveUntil(
             MaterialPageRoute(
             MaterialPageRoute(
               builder: (BuildContext context) {
               builder: (BuildContext context) {
@@ -460,6 +463,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
         }
         }
       }
       }
 
 
+      // ignore: unawaited_futures
       routeToPage(
       routeToPage(
         context,
         context,
         RecoveryKeyPage(
         RecoveryKeyPage(
@@ -475,6 +479,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
       _logger.severe(e);
       _logger.severe(e);
       await dialog.hide();
       await dialog.hide();
       if (e is UnsupportedError) {
       if (e is UnsupportedError) {
+        // ignore: unawaited_futures
         showErrorDialog(
         showErrorDialog(
           context,
           context,
           S.of(context).insecureDevice,
           S.of(context).insecureDevice,

+ 1 - 0
lib/ui/account/password_reentry_page.dart

@@ -120,6 +120,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
           firstButtonLabel: S.of(context).useRecoveryKey,
           firstButtonLabel: S.of(context).useRecoveryKey,
         );
         );
         if (dialogChoice!.action == ButtonAction.first) {
         if (dialogChoice!.action == ButtonAction.first) {
+          // ignore: unawaited_futures
           Navigator.of(context).push(
           Navigator.of(context).push(
             MaterialPageRoute(
             MaterialPageRoute(
               builder: (BuildContext context) {
               builder: (BuildContext context) {

+ 1 - 0
lib/ui/account/recovery_key_page.dart

@@ -1,3 +1,4 @@
+import "dart:async";
 import 'dart:io';
 import 'dart:io';
 
 
 import 'package:bip39/bip39.dart' as bip39;
 import 'package:bip39/bip39.dart' as bip39;

+ 2 - 0
lib/ui/account/recovery_page.dart

@@ -54,6 +54,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
             await Configuration.instance.recover(_recoveryKey.text.trim());
             await Configuration.instance.recover(_recoveryKey.text.trim());
             await dialog.hide();
             await dialog.hide();
             showShortToast(context, S.of(context).recoverySuccessful);
             showShortToast(context, S.of(context).recoverySuccessful);
+            // ignore: unawaited_futures
             Navigator.of(context).pushReplacement(
             Navigator.of(context).pushReplacement(
               MaterialPageRoute(
               MaterialPageRoute(
                 builder: (BuildContext context) {
                 builder: (BuildContext context) {
@@ -72,6 +73,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
             if (e is AssertionError) {
             if (e is AssertionError) {
               errMessage = '$errMessage : ${e.message}';
               errMessage = '$errMessage : ${e.message}';
             }
             }
+            // ignore: unawaited_futures
             showErrorDialog(
             showErrorDialog(
               context,
               context,
               S.of(context).incorrectRecoveryKeyTitle,
               S.of(context).incorrectRecoveryKeyTitle,

+ 5 - 4
lib/ui/account/request_pwd_verification_page.dart

@@ -84,7 +84,7 @@ class _RequestPasswordVerificationPageState
         onPressedFunction: () async {
         onPressedFunction: () async {
           FocusScope.of(context).unfocus();
           FocusScope.of(context).unfocus();
           final dialog = createProgressDialog(context, context.l10n.pleaseWait);
           final dialog = createProgressDialog(context, context.l10n.pleaseWait);
-          dialog.show();
+          await dialog.show();
           try {
           try {
             final attributes = Configuration.instance.getKeyAttributes()!;
             final attributes = Configuration.instance.getKeyAttributes()!;
             final Uint8List keyEncryptionKey = await CryptoUtil.deriveKey(
             final Uint8List keyEncryptionKey = await CryptoUtil.deriveKey(
@@ -98,17 +98,18 @@ class _RequestPasswordVerificationPageState
               keyEncryptionKey,
               keyEncryptionKey,
               CryptoUtil.base642bin(attributes.keyDecryptionNonce),
               CryptoUtil.base642bin(attributes.keyDecryptionNonce),
             );
             );
-            dialog.show();
+            await dialog.show();
             // pop
             // pop
             await widget.onPasswordVerified(keyEncryptionKey);
             await widget.onPasswordVerified(keyEncryptionKey);
-            dialog.hide();
+            await dialog.hide();
             Navigator.of(context).pop(true);
             Navigator.of(context).pop(true);
           } catch (e, s) {
           } catch (e, s) {
             _logger.severe("Error while verifying password", e, s);
             _logger.severe("Error while verifying password", e, s);
-            dialog.hide();
+            await dialog.hide();
             if (widget.onPasswordError != null) {
             if (widget.onPasswordError != null) {
               widget.onPasswordError!();
               widget.onPasswordError!();
             } else {
             } else {
+              // ignore: unawaited_futures
               showErrorDialog(
               showErrorDialog(
                 context,
                 context,
                 context.l10n.incorrectPasswordTitle,
                 context.l10n.incorrectPasswordTitle,

+ 2 - 1
lib/ui/account/sessions_page.dart

@@ -121,6 +121,7 @@ class _SessionsPageState extends State<SessionsPage> {
     } catch (e) {
     } catch (e) {
       await dialog.hide();
       await dialog.hide();
       _logger.severe('failed to terminate');
       _logger.severe('failed to terminate');
+      // ignore: unawaited_futures
       showErrorDialog(
       showErrorDialog(
         context,
         context,
         S.of(context).oops,
         S.of(context).oops,
@@ -184,7 +185,7 @@ class _SessionsPageState extends State<SessionsPage> {
             if (isLoggingOutFromThisDevice) {
             if (isLoggingOutFromThisDevice) {
               await UserService.instance.logout(context);
               await UserService.instance.logout(context);
             } else {
             } else {
-              _terminateSession(session);
+              await _terminateSession(session);
             }
             }
           },
           },
         ),
         ),

+ 1 - 1
lib/ui/account/two_factor_authentication_page.dart

@@ -114,7 +114,7 @@ class _TwoFactorAuthenticationPageState
           child: OutlinedButton(
           child: OutlinedButton(
             onPressed: _code.length == 6
             onPressed: _code.length == 6
                 ? () async {
                 ? () async {
-                    _verifyTwoFactorCode(_code);
+                    await _verifyTwoFactorCode(_code);
                   }
                   }
                 : null,
                 : null,
             child: Text(S.of(context).verify),
             child: Text(S.of(context).verify),

+ 1 - 1
lib/ui/account/two_factor_setup_page.dart

@@ -251,7 +251,7 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
         OutlinedButton(
         OutlinedButton(
           onPressed: _code.length == 6
           onPressed: _code.length == 6
               ? () async {
               ? () async {
-                  _enableTwoFactor(_code);
+                  await _enableTwoFactor(_code);
                 }
                 }
               : null,
               : null,
           child: Text(S.of(context).confirm),
           child: Text(S.of(context).confirm),

+ 1 - 0
lib/ui/account/verify_recovery_page.dart

@@ -97,6 +97,7 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
         recoveryKey = CryptoUtil.bin2hex(
         recoveryKey = CryptoUtil.bin2hex(
           await UserService.instance.getOrCreateRecoveryKey(context),
           await UserService.instance.getOrCreateRecoveryKey(context),
         );
         );
+        // ignore: unawaited_futures
         routeToPage(
         routeToPage(
           context,
           context,
           RecoveryKeyPage(
           RecoveryKeyPage(

+ 8 - 6
lib/ui/actions/collection/collection_file_actions.dart

@@ -1,3 +1,5 @@
+import "dart:async";
+
 import 'package:flutter/cupertino.dart';
 import 'package:flutter/cupertino.dart';
 import "package:photo_manager/photo_manager.dart";
 import "package:photo_manager/photo_manager.dart";
 import "package:photos/core/configuration.dart";
 import "package:photos/core/configuration.dart";
@@ -184,7 +186,7 @@ extension CollectionFileActions on CollectionActions {
       if (files.isNotEmpty) {
       if (files.isNotEmpty) {
         await CollectionsService.instance.addToCollection(collectionID, files);
         await CollectionsService.instance.addToCollection(collectionID, files);
       }
       }
-      RemoteSyncService.instance.sync(silently: true);
+      unawaited(RemoteSyncService.instance.sync(silently: true));
       await dialog?.hide();
       await dialog?.hide();
       return true;
       return true;
     } catch (e, s) {
     } catch (e, s) {
@@ -214,11 +216,11 @@ extension CollectionFileActions on CollectionActions {
       return true;
       return true;
     } catch (e, s) {
     } catch (e, s) {
       logger.severe(e, s);
       logger.severe(e, s);
-      showShortToast(
-        context,
-        markAsFavorite
-            ? S.of(context).sorryCouldNotAddToFavorites
-            : S.of(context).sorryCouldNotRemoveFromFavorites,
+        showShortToast(
+          context,
+          markAsFavorite
+              ? S.of(context).sorryCouldNotAddToFavorites
+              : S.of(context).sorryCouldNotRemoveFromFavorites,
       );
       );
     } finally {
     } finally {
       await dialog.hide();
       await dialog.hide();

+ 4 - 6
lib/ui/actions/collection/collection_sharing_actions.dart

@@ -115,7 +115,7 @@ class CollectionActions {
       S.of(context).creatingLink,
       S.of(context).creatingLink,
       isDismissible: true,
       isDismissible: true,
     );
     );
-    dialog.show();
+    await dialog.show();
     try {
     try {
       // create album with emptyName, use collectionCreationTime on UI to
       // create album with emptyName, use collectionCreationTime on UI to
       // show name
       // show name
@@ -143,10 +143,10 @@ class CollectionActions {
       await collectionsService.addToCollection(collection.id, files);
       await collectionsService.addToCollection(collection.id, files);
       logger.finest("creating public link for the newly created album");
       logger.finest("creating public link for the newly created album");
       await CollectionsService.instance.createShareUrl(collection);
       await CollectionsService.instance.createShareUrl(collection);
-      dialog.hide();
+      await dialog.hide();
       return collection;
       return collection;
     } catch (e, s) {
     } catch (e, s) {
-      dialog.hide();
+      await dialog.hide();
       await showGenericErrorDialog(context: context, error: e);
       await showGenericErrorDialog(context: context, error: e);
       logger.severe("Failing to create link for selected files", e, s);
       logger.severe("Failing to create link for selected files", e, s);
     }
     }
@@ -467,9 +467,7 @@ class CollectionActions {
     }
     }
 
 
     if (!isCollectionOwner && split.ownedByOtherUsers.isNotEmpty) {
     if (!isCollectionOwner && split.ownedByOtherUsers.isNotEmpty) {
-      unawaited(
-        showShortToast(context, S.of(context).canOnlyRemoveFilesOwnedByYou),
-      );
+      showShortToast(context, S.of(context).canOnlyRemoveFilesOwnedByYou);
       return;
       return;
     }
     }
 
 

+ 2 - 0
lib/ui/actions/file/file_actions.dart

@@ -1,3 +1,5 @@
+import "dart:async";
+
 import "package:flutter/cupertino.dart";
 import "package:flutter/cupertino.dart";
 import "package:modal_bottom_sheet/modal_bottom_sheet.dart";
 import "package:modal_bottom_sheet/modal_bottom_sheet.dart";
 import "package:photos/generated/l10n.dart";
 import "package:photos/generated/l10n.dart";

+ 1 - 0
lib/ui/collections/album/row_item.dart

@@ -189,6 +189,7 @@ class AlbumRowItemWidget extends StatelessWidget {
       ),
       ),
       onTap: () async {
       onTap: () async {
         final thumbnail = await CollectionsService.instance.getCover(c);
         final thumbnail = await CollectionsService.instance.getCover(c);
+        // ignore: unawaited_futures
         routeToPage(
         routeToPage(
           context,
           context,
           CollectionPage(
           CollectionPage(

+ 1 - 1
lib/ui/collections/album/vertical_list.dart

@@ -120,7 +120,7 @@ class AlbumVerticalListWidget extends StatelessWidget {
       }
       }
     } else {
     } else {
       Navigator.pop(context);
       Navigator.pop(context);
-      await showToast(
+      showToast(
         context,
         context,
         S.of(context).createAlbumActionHint,
         S.of(context).createAlbumActionHint,
       );
       );

+ 5 - 7
lib/ui/payment/stripe_subscription_page.dart

@@ -400,13 +400,11 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
           : await _billingService.cancelStripeSubscription();
           : await _billingService.cancelStripeSubscription();
       await _fetchSub();
       await _fetchSub();
     } catch (e) {
     } catch (e) {
-      unawaited(
-        showShortToast(
-          context,
-          isAutoRenewDisabled
-              ? S.of(context).failedToRenew
-              : S.of(context).failedToCancel,
-        ),
+      showShortToast(
+        context,
+        isAutoRenewDisabled
+            ? S.of(context).failedToRenew
+            : S.of(context).failedToCancel,
       );
       );
     }
     }
     await _dialog.hide();
     await _dialog.hide();

+ 1 - 1
lib/ui/settings/backup/backup_section_widget.dart

@@ -225,7 +225,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
         showShortToast(
         showShortToast(
           context,
           context,
           S.of(context).remindToEmptyEnteTrash,
           S.of(context).remindToEmptyEnteTrash,
-        ).ignore();
+        );
       },
       },
     );
     );
   }
   }

+ 2 - 2
lib/ui/settings/debug_section_widget.dart

@@ -50,7 +50,7 @@ class DebugSectionWidget extends StatelessWidget {
           trailingIconIsMuted: true,
           trailingIconIsMuted: true,
           onTap: () async {
           onTap: () async {
             await LocalSyncService.instance.resetLocalSync();
             await LocalSyncService.instance.resetLocalSync();
-            showShortToast(context, "Done").ignore();
+            showShortToast(context, "Done");
           },
           },
         ),
         ),
         sectionOptionSpacing,
         sectionOptionSpacing,
@@ -64,7 +64,7 @@ class DebugSectionWidget extends StatelessWidget {
           onTap: () async {
           onTap: () async {
             await IgnoredFilesService.instance.reset();
             await IgnoredFilesService.instance.reset();
             SyncService.instance.sync().ignore();
             SyncService.instance.sync().ignore();
-            showShortToast(context, "Done").ignore();
+            showShortToast(context, "Done");
           },
           },
         ),
         ),
         sectionOptionSpacing,
         sectionOptionSpacing,

+ 1 - 1
lib/ui/settings/security_section_widget.dart

@@ -279,7 +279,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
       }
       }
       await UserService.instance.updateEmailMFA(isEnabled);
       await UserService.instance.updateEmailMFA(isEnabled);
     } catch (e) {
     } catch (e) {
-      showToast(context, S.of(context).somethingWentWrong).ignore();
+      showToast(context, S.of(context).somethingWentWrong);
     }
     }
   }
   }
 }
 }

+ 1 - 1
lib/ui/tabs/shared/empty_state.dart

@@ -139,7 +139,7 @@ class OutgoingAlbumEmptyState extends StatelessWidget {
             labelText: S.of(context).shareYourFirstAlbum,
             labelText: S.of(context).shareYourFirstAlbum,
             icon: Icons.add,
             icon: Icons.add,
             onTap: () async {
             onTap: () async {
-              await showToast(
+              showToast(
                 context,
                 context,
                 S.of(context).shareAlbumHint,
                 S.of(context).shareAlbumHint,
               );
               );

+ 4 - 6
lib/ui/viewer/actions/file_selection_actions_widget.dart

@@ -502,11 +502,9 @@ class _FileSelectionActionsWidgetState
 
 
   Future<void> _onCreatedSharedLinkClicked() async {
   Future<void> _onCreatedSharedLinkClicked() async {
     if (split.ownedByCurrentUser.isEmpty) {
     if (split.ownedByCurrentUser.isEmpty) {
-      unawaited(
-        showShortToast(
-          context,
-          S.of(context).canOnlyCreateLinkForFilesOwnedByYou,
-        ),
+      showShortToast(
+        context,
+        S.of(context).canOnlyCreateLinkForFilesOwnedByYou,
       );
       );
       return;
       return;
     }
     }
@@ -570,7 +568,7 @@ class _FileSelectionActionsWidgetState
       final String url =
       final String url =
           "${_cachedCollectionForSharedLink!.publicURLs?.first?.url}#$collectionKey";
           "${_cachedCollectionForSharedLink!.publicURLs?.first?.url}#$collectionKey";
       await Clipboard.setData(ClipboardData(text: url));
       await Clipboard.setData(ClipboardData(text: url));
-      unawaited(showShortToast(context, S.of(context).linkCopiedToClipboard));
+      showShortToast(context, S.of(context).linkCopiedToClipboard);
     }
     }
   }
   }
 
 

+ 0 - 10
lib/ui/viewer/file/zoomable_image.dart

@@ -22,7 +22,6 @@ import 'package:photos/ui/common/loading_widget.dart';
 import 'package:photos/utils/file_util.dart';
 import 'package:photos/utils/file_util.dart';
 import 'package:photos/utils/image_util.dart';
 import 'package:photos/utils/image_util.dart';
 import 'package:photos/utils/thumbnail_util.dart';
 import 'package:photos/utils/thumbnail_util.dart';
-import "package:photos/utils/toast_util.dart";
 
 
 class ZoomableImage extends StatefulWidget {
 class ZoomableImage extends StatefulWidget {
   final EnteFile photo;
   final EnteFile photo;
@@ -262,12 +261,6 @@ class _ZoomableImageState extends State<ZoomableImage>
     final bool shouldFixPosition = previewImageProvider != null && _isZooming;
     final bool shouldFixPosition = previewImageProvider != null && _isZooming;
     ImageInfo? finalImageInfo;
     ImageInfo? finalImageInfo;
     if (shouldFixPosition) {
     if (shouldFixPosition) {
-      if (kDebugMode) {
-        showToast(
-          context,
-          'Updating photo scale zooming and scale: ${_photoViewController.scale}',
-        ).ignore();
-      }
       final prevImageInfo = await getImageInfo(previewImageProvider);
       final prevImageInfo = await getImageInfo(previewImageProvider);
       finalImageInfo = await getImageInfo(finalImageProvider);
       finalImageInfo = await getImageInfo(finalImageProvider);
       final scale = _photoViewController.scale! /
       final scale = _photoViewController.scale! /
@@ -303,9 +296,6 @@ class _ZoomableImageState extends State<ZoomableImage>
     if (h != enteFile.height || w != enteFile.width) {
     if (h != enteFile.height || w != enteFile.width) {
       final logMessage =
       final logMessage =
           'Updating aspect ratio for from ${enteFile.height}x${enteFile.width} to ${h}x$w';
           'Updating aspect ratio for from ${enteFile.height}x${enteFile.width} to ${h}x$w';
-      if (kDebugMode && (enteFile.height != 0 || enteFile.width != 0)) {
-        showToast(context, logMessage).ignore();
-      }
       _logger.info(logMessage);
       _logger.info(logMessage);
       await FileMagicService.instance.updatePublicMagicMetadata([
       await FileMagicService.instance.updatePublicMagicMetadata([
         enteFile,
         enteFile,

+ 3 - 5
lib/ui/viewer/file_details/favorite_widget.dart

@@ -79,11 +79,9 @@ class _FavoriteWidgetState extends State<FavoriteWidget> {
               } catch (e, s) {
               } catch (e, s) {
                 _logger.severe(e, s);
                 _logger.severe(e, s);
                 hasError = true;
                 hasError = true;
-                unawaited(
-                  showToast(
-                    context,
-                    S.of(context).sorryCouldNotRemoveFromFavorites,
-                  ),
+                showToast(
+                  context,
+                  S.of(context).sorryCouldNotRemoveFromFavorites,
                 );
                 );
               }
               }
             }
             }

+ 1 - 1
lib/ui/viewer/gallery/gallery.dart

@@ -141,7 +141,7 @@ class GalleryState extends State<Gallery> {
       // todo: Assign ID to Gallery and fire generic event with ID &
       // todo: Assign ID to Gallery and fire generic event with ID &
       //  target index/date
       //  target index/date
       if (mounted && event.selectedIndex == 0) {
       if (mounted && event.selectedIndex == 0) {
-        _itemScroller.scrollTo(
+        await _itemScroller.scrollTo(
           index: 0,
           index: 0,
           duration: const Duration(milliseconds: 150),
           duration: const Duration(milliseconds: 150),
         );
         );

+ 6 - 8
lib/ui/viewer/gallery/gallery_app_bar_widget.dart

@@ -131,12 +131,10 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
     if (galleryType != GalleryType.ownedCollection &&
     if (galleryType != GalleryType.ownedCollection &&
         galleryType != GalleryType.hiddenOwnedCollection &&
         galleryType != GalleryType.hiddenOwnedCollection &&
         galleryType != GalleryType.quickLink) {
         galleryType != GalleryType.quickLink) {
-      unawaited(
-        showToast(
-          context,
-          'Type of galler $galleryType is not supported for '
-          'rename',
-        ),
+      showToast(
+        context,
+        'Type of galler $galleryType is not supported for '
+        'rename',
       );
       );
 
 
       return;
       return;
@@ -269,7 +267,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
           showToast(
           showToast(
             context,
             context,
             S.of(context).remindToEmptyDeviceTrash,
             S.of(context).remindToEmptyDeviceTrash,
-          ).ignore();
+          );
         }
         }
       },
       },
     );
     );
@@ -614,7 +612,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
                 context,
                 context,
               );
               );
             } else {
             } else {
-              unawaited(showToast(context, S.of(context).somethingWentWrong));
+              showToast(context, S.of(context).somethingWentWrong);
             }
             }
           },
           },
         ),
         ),

+ 1 - 1
lib/ui/viewer/gallery/hooks/add_photos_sheet.dart

@@ -216,7 +216,7 @@ class AddPhotosPhotoWidget extends StatelessWidget {
             },
             },
           );
           );
         } else {
         } else {
-          showErrorDialog(
+          await showErrorDialog(
             context,
             context,
             context.l10n.oops,
             context.l10n.oops,
             context.l10n.somethingWentWrong + (kDebugMode ? "\n$e" : ""),
             context.l10n.somethingWentWrong + (kDebugMode ? "\n$e" : ""),

+ 1 - 0
lib/ui/viewer/search/result/go_to_map_widget.dart

@@ -22,6 +22,7 @@ class GoToMapWidget extends StatelessWidget {
       onTap: () async {
       onTap: () async {
         final bool result = await requestForMapEnable(context);
         final bool result = await requestForMapEnable(context);
         if (result) {
         if (result) {
+          // ignore: unawaited_futures
           Navigator.of(context).push(
           Navigator.of(context).push(
             MaterialPageRoute(
             MaterialPageRoute(
               builder: (context) => MapScreen(
               builder: (context) => MapScreen(

+ 1 - 0
lib/ui/viewer/search/tab_empty_state.dart

@@ -35,6 +35,7 @@ class SearchTabEmptyState extends StatelessWidget {
               labelText: S.of(context).addYourPhotosNow,
               labelText: S.of(context).addYourPhotosNow,
               icon: Icons.arrow_forward_outlined,
               icon: Icons.arrow_forward_outlined,
               onTap: () async {
               onTap: () async {
+                // ignore: unawaited_futures
                 routeToPage(
                 routeToPage(
                   context,
                   context,
                   BackupFolderSelectionPage(
                   BackupFolderSelectionPage(

+ 2 - 2
lib/utils/delete_file_util.dart

@@ -127,9 +127,9 @@ Future<void> deleteFilesFromEverywhere(
       ),
       ),
     );
     );
     if (hasLocalOnlyFiles && Platform.isAndroid) {
     if (hasLocalOnlyFiles && Platform.isAndroid) {
-      await showShortToast(context, S.of(context).filesDeleted);
+      showShortToast(context, S.of(context).filesDeleted);
     } else {
     } else {
-      await showShortToast(context, S.of(context).movedToTrash);
+      showShortToast(context, S.of(context).movedToTrash);
     }
     }
   }
   }
   if (uploadedFilesToBeTrashed.isNotEmpty) {
   if (uploadedFilesToBeTrashed.isNotEmpty) {

+ 1 - 0
lib/utils/file_uploader.dart

@@ -106,6 +106,7 @@ class FileUploader {
         );
         );
         _logger.info("BG task was found dead, cleared all locks");
         _logger.info("BG task was found dead, cleared all locks");
       }
       }
+      // ignore: unawaited_futures
       _pollBackgroundUploadStatus();
       _pollBackgroundUploadStatus();
     }
     }
     Bus.instance.on<LocalPhotosUpdatedEvent>().listen((event) {
     Bus.instance.on<LocalPhotosUpdatedEvent>().listen((event) {

+ 4 - 3
lib/utils/file_util.dart

@@ -165,9 +165,10 @@ Future<File?> getFileFromServer(
         },
         },
       );
       );
     }
     }
-    downloadFuture.then((downloadedFile) {
+    // ignore: unawaited_futures
+    downloadFuture.then((downloadedFile) async {
       completer.complete(downloadedFile);
       completer.complete(downloadedFile);
-      _fileDownloadsInProgress.remove(downloadID);
+      await _fileDownloadsInProgress.remove(downloadID);
       _progressCallbacks.remove(downloadID);
       _progressCallbacks.remove(downloadID);
     });
     });
   }
   }
@@ -197,7 +198,7 @@ Future<File?> _getLivePhotoFromServer(
           _downloadLivePhoto(file, progressCallback: progressCallback);
           _downloadLivePhoto(file, progressCallback: progressCallback);
     }
     }
     final livePhoto = await _livePhotoDownloadsTracker[file.uploadedFileID];
     final livePhoto = await _livePhotoDownloadsTracker[file.uploadedFileID];
-    _livePhotoDownloadsTracker.remove(downloadID);
+    await _livePhotoDownloadsTracker.remove(downloadID);
     if (livePhoto == null) {
     if (livePhoto == null) {
       return null;
       return null;
     }
     }

+ 6 - 6
lib/utils/magic_util.dart

@@ -116,7 +116,7 @@ Future<void> changeSortOrder(
     );
     );
   } catch (e, s) {
   } catch (e, s) {
     _logger.severe("failed to update collection visibility", e, s);
     _logger.severe("failed to update collection visibility", e, s);
-    unawaited(showShortToast(context, S.of(context).somethingWentWrong));
+    showShortToast(context, S.of(context).somethingWentWrong);
     rethrow;
     rethrow;
   }
   }
 }
 }
@@ -136,7 +136,7 @@ Future<void> updateOrder(
     );
     );
   } catch (e, s) {
   } catch (e, s) {
     _logger.severe("failed to update order", e, s);
     _logger.severe("failed to update order", e, s);
-    unawaited(showShortToast(context, S.of(context).somethingWentWrong));
+    showShortToast(context, S.of(context).somethingWentWrong);
     rethrow;
     rethrow;
   }
   }
 }
 }
@@ -162,7 +162,7 @@ Future<void> changeCoverPhoto(
     );
     );
   } catch (e, s) {
   } catch (e, s) {
     _logger.severe("failed to update cover", e, s);
     _logger.severe("failed to update cover", e, s);
-    unawaited(showShortToast(context, S.of(context).somethingWentWrong));
+    showShortToast(context, S.of(context).somethingWentWrong);
     rethrow;
     rethrow;
   }
   }
 }
 }
@@ -181,7 +181,7 @@ Future<bool> editTime(
     );
     );
     return true;
     return true;
   } catch (e) {
   } catch (e) {
-    showShortToast(context, S.of(context).somethingWentWrong).ignore();
+    showShortToast(context, S.of(context).somethingWentWrong);
     return false;
     return false;
   }
   }
 }
 }
@@ -240,7 +240,7 @@ Future<bool> editFileCaption(
     return true;
     return true;
   } catch (e) {
   } catch (e) {
     if (context != null) {
     if (context != null) {
-      unawaited(showShortToast(context, S.of(context).somethingWentWrong));
+      showShortToast(context, S.of(context).somethingWentWrong);
     }
     }
     return false;
     return false;
   }
   }
@@ -267,7 +267,7 @@ Future<void> _updatePublicMetadata(
     await FileMagicService.instance.updatePublicMagicMetadata(files, update);
     await FileMagicService.instance.updatePublicMagicMetadata(files, update);
     if (context != null) {
     if (context != null) {
       if (showDoneToast) {
       if (showDoneToast) {
-        await showShortToast(context, S.of(context).done);
+        showShortToast(context, S.of(context).done);
       }
       }
       await dialog?.hide();
       await dialog?.hide();
     }
     }

+ 23 - 18
lib/utils/toast_util.dart

@@ -1,3 +1,4 @@
+import "dart:async";
 import 'dart:io';
 import 'dart:io';
 
 
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
@@ -5,7 +6,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
 import 'package:fluttertoast/fluttertoast.dart';
 import 'package:fluttertoast/fluttertoast.dart';
 import 'package:photos/ente_theme_data.dart';
 import 'package:photos/ente_theme_data.dart';
 
 
-Future showToast(
+void showToast(
   BuildContext context,
   BuildContext context,
   String message, {
   String message, {
   toastLength = Toast.LENGTH_LONG,
   toastLength = Toast.LENGTH_LONG,
@@ -13,14 +14,16 @@ Future showToast(
 }) async {
 }) async {
   if (Platform.isAndroid) {
   if (Platform.isAndroid) {
     await Fluttertoast.cancel();
     await Fluttertoast.cancel();
-    return Fluttertoast.showToast(
-      msg: message,
-      toastLength: toastLength,
-      gravity: ToastGravity.BOTTOM,
-      timeInSecForIosWeb: 1,
-      backgroundColor: Theme.of(context).colorScheme.toastBackgroundColor,
-      textColor: Theme.of(context).colorScheme.toastTextColor,
-      fontSize: 16.0,
+    unawaited(
+      Fluttertoast.showToast(
+        msg: message,
+        toastLength: toastLength,
+        gravity: ToastGravity.BOTTOM,
+        timeInSecForIosWeb: 1,
+        backgroundColor: Theme.of(context).colorScheme.toastBackgroundColor,
+        textColor: Theme.of(context).colorScheme.toastTextColor,
+        fontSize: 16.0,
+      ),
     );
     );
   } else {
   } else {
     EasyLoading.instance
     EasyLoading.instance
@@ -29,18 +32,20 @@ Future showToast(
       ..textColor = Theme.of(context).colorScheme.toastTextColor
       ..textColor = Theme.of(context).colorScheme.toastTextColor
       ..userInteractions = true
       ..userInteractions = true
       ..loadingStyle = EasyLoadingStyle.custom;
       ..loadingStyle = EasyLoadingStyle.custom;
-    return EasyLoading.showToast(
-      message,
-      duration: Duration(
-        seconds:
-            (toastLength == Toast.LENGTH_LONG ? iosLongToastLengthInSec : 1),
+    unawaited(
+      EasyLoading.showToast(
+        message,
+        duration: Duration(
+          seconds:
+              (toastLength == Toast.LENGTH_LONG ? iosLongToastLengthInSec : 1),
+        ),
+        toastPosition: EasyLoadingToastPosition.bottom,
+        dismissOnTap: false,
       ),
       ),
-      toastPosition: EasyLoadingToastPosition.bottom,
-      dismissOnTap: false,
     );
     );
   }
   }
 }
 }
 
 
-Future<void> showShortToast(context, String message) {
-  return showToast(context, message, toastLength: Toast.LENGTH_SHORT);
+void showShortToast(context, String message) {
+  showToast(context, message, toastLength: Toast.LENGTH_SHORT);
 }
 }