Browse Source

Fix warnings around missing awaits

vishnukvmd 1 year ago
parent
commit
3b498f1be6
38 changed files with 108 additions and 42 deletions
  1. 3 3
      auth/lib/core/logging/super_logging.dart
  2. 3 2
      auth/lib/main.dart
  3. 2 0
      auth/lib/onboarding/view/onboarding_page.dart
  4. 1 1
      auth/lib/services/authenticator_service.dart
  5. 1 0
      auth/lib/services/local_authentication_service.dart
  6. 1 0
      auth/lib/services/notification_service.dart
  7. 6 3
      auth/lib/services/update_service.dart
  8. 25 4
      auth/lib/services/user_service.dart
  9. 1 1
      auth/lib/ui/account/delete_account_page.dart
  10. 2 1
      auth/lib/ui/account/login_page.dart
  11. 1 0
      auth/lib/ui/account/logout_dialog.dart
  12. 6 1
      auth/lib/ui/account/password_entry_page.dart
  13. 1 0
      auth/lib/ui/account/password_reentry_page.dart
  14. 2 0
      auth/lib/ui/account/recovery_page.dart
  15. 5 4
      auth/lib/ui/account/request_pwd_verification_page.dart
  16. 2 1
      auth/lib/ui/account/sessions_page.dart
  17. 2 0
      auth/lib/ui/account/verify_recovery_page.dart
  18. 2 1
      auth/lib/ui/code_widget.dart
  19. 1 0
      auth/lib/ui/common/progress_dialog.dart
  20. 3 2
      auth/lib/ui/home_page.dart
  21. 3 0
      auth/lib/ui/settings/about_section_widget.dart
  22. 5 0
      auth/lib/ui/settings/account_section_widget.dart
  23. 2 1
      auth/lib/ui/settings/app_update_dialog.dart
  24. 1 0
      auth/lib/ui/settings/danger_section_widget.dart
  25. 1 0
      auth/lib/ui/settings/data/data_section_widget.dart
  26. 1 1
      auth/lib/ui/settings/data/export_widget.dart
  27. 1 0
      auth/lib/ui/settings/data/import/google_auth_import.dart
  28. 8 8
      auth/lib/ui/settings/data/import/import_service.dart
  29. 1 1
      auth/lib/ui/settings/data/import_page.dart
  30. 1 0
      auth/lib/ui/settings/developer_settings_page.dart
  31. 1 0
      auth/lib/ui/settings/general_section_widget.dart
  32. 1 0
      auth/lib/ui/settings/security_section_widget.dart
  33. 1 0
      auth/lib/ui/settings/social_section_widget.dart
  34. 2 0
      auth/lib/ui/settings/support_section_widget.dart
  35. 1 1
      auth/lib/ui/tools/lock_screen.dart
  36. 1 1
      auth/lib/ui/two_factor_authentication_page.dart
  37. 3 1
      auth/lib/utils/email_util.dart
  38. 4 4
      auth/lib/utils/toast_util.dart

+ 3 - 3
auth/lib/core/logging/super_logging.dart

@@ -167,7 +167,7 @@ class SuperLogging {
       await setupLogDir();
     }
     if (sentryIsEnabled) {
-      setupSentry();
+      await setupSentry();
     }
 
     Logger.root.level = Level.ALL;
@@ -250,7 +250,7 @@ class SuperLogging {
 
     // add error to sentry queue
     if (sentryIsEnabled && rec.error != null) {
-      _sendErrorToSentry(rec.error!, null);
+      await _sendErrorToSentry(rec.error!, null);
     }
   }
 
@@ -289,7 +289,7 @@ class SuperLogging {
     SuperLogging.setUserID(await _getOrCreateAnonymousUserID());
     await for (final error in sentryQueueControl.stream.asBroadcastStream()) {
       try {
-        Sentry.captureException(
+        await Sentry.captureException(
           error,
         );
       } catch (e) {

+ 3 - 2
auth/lib/main.dart

@@ -1,3 +1,4 @@
+import 'dart:async';
 import 'dart:io';
 
 import 'package:adaptive_theme/adaptive_theme.dart';
@@ -46,7 +47,7 @@ Future<void> _runInForeground() async {
     _logger.info("Starting app in foreground");
     await _init(false, via: 'mainMethod');
     final Locale locale = await getLocale();
-    UpdateService.instance.showUpdateNotification();
+    unawaited(UpdateService.instance.showUpdateNotification());
     runApp(
       AppLock(
         builder: (args) => App(locale: locale),
@@ -83,7 +84,7 @@ Future _runWithLogs(Function() function, {String prefix = ""}) async {
 
 Future<void> _init(bool bool, {String? via}) async {
   // 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 PreferenceService.instance.init();
   await CodeStore.instance.init();

+ 2 - 0
auth/lib/onboarding/view/onboarding_page.dart

@@ -103,6 +103,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
                                 ),
                                 onTap: () async {
                                   final locale = await getLocale();
+                                  // ignore: unawaited_futures
                                   routeToPage(
                                     context,
                                     LanguageSelectorPage(
@@ -228,6 +229,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
     }
     if (hasOptedBefore || result?.action == ButtonAction.first) {
       await Configuration.instance.optForOfflineMode();
+      // ignore: unawaited_futures
       Navigator.of(context).push(
         MaterialPageRoute(
           builder: (BuildContext context) {

+ 1 - 1
auth/lib/services/authenticator_service.dart

@@ -208,7 +208,7 @@ class AuthenticatorService {
     if (deletedIDs.isNotEmpty) {
       await _db.deleteByIDs(ids: deletedIDs);
     }
-    _prefs.setInt(_lastEntitySyncTime, maxSyncTime);
+    await _prefs.setInt(_lastEntitySyncTime, maxSyncTime);
     _logger.info("Setting synctime to " + maxSyncTime.toString());
     if (result.length == fetchLimit) {
       _logger.info("Diff limit reached, pulling again");

+ 1 - 0
auth/lib/services/local_authentication_service.dart

@@ -54,6 +54,7 @@ class LocalAuthenticationService {
             .setEnabled(Configuration.instance.shouldShowLockScreen());
       }
     } else {
+      // ignore: unawaited_futures
       showErrorDialog(
         context,
         errorDialogTitle,

+ 1 - 0
auth/lib/services/notification_service.dart

@@ -27,6 +27,7 @@ class NotificationService {
         _flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<
             AndroidFlutterLocalNotificationsPlugin>();
     if (implementation != null) {
+      // ignore: unawaited_futures
       implementation.requestPermission();
     }
   }

+ 6 - 3
auth/lib/services/update_service.dart

@@ -1,3 +1,4 @@
+import 'dart:async';
 import 'dart:io';
 
 import 'package:ente_auth/core/constants.dart';
@@ -70,9 +71,11 @@ class UpdateService {
     if (shouldUpdate &&
         hasBeen3DaysSinceLastNotification &&
         _latestVersion!.shouldNotify!) {
-      NotificationService.instance.showNotification(
-        "Update available",
-        "Click to install our best version yet",
+      unawaited(
+        NotificationService.instance.showNotification(
+          "Update available",
+          "Click to install our best version yet",
+        ),
       );
       await _prefs.setInt(kUpdateAvailableShownTimeKey, now);
     } else {

+ 25 - 4
auth/lib/services/user_service.dart

@@ -147,18 +147,18 @@ class UserService {
       final userDetails = UserDetails.fromMap(response.data);
       if (shouldCache) {
         if (userDetails.profileData != null) {
-          _preferences.setBool(
+          await _preferences.setBool(
             kIsEmailMFAEnabled,
             userDetails.profileData!.isEmailMFAEnabled,
           );
-          _preferences.setBool(
+          await _preferences.setBool(
             kCanDisableEmailMFA,
             userDetails.profileData!.canDisableEmailMFA,
           );
         }
         // handle email change from different client
         if (userDetails.email != _config.getEmail()) {
-          setEmail(userDetails.email);
+          await setEmail(userDetails.email);
         }
       }
       return userDetails;
@@ -282,6 +282,7 @@ class UserService {
       throw Exception("unexpected response during passkey verification");
     }
 
+    // ignore: unawaited_futures
     Navigator.of(context).pushAndRemoveUntil(
       MaterialPageRoute(
         builder: (BuildContext context) {
@@ -331,6 +332,7 @@ class UserService {
             );
           }
         }
+        // ignore: unawaited_futures
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
             builder: (BuildContext context) {
@@ -354,6 +356,7 @@ class UserService {
         );
         Navigator.of(context).pop();
       } else {
+        // ignore: unawaited_futures
         showErrorDialog(
           context,
           context.l10n.incorrectCode,
@@ -363,6 +366,7 @@ class UserService {
     } catch (e) {
       await dialog.hide();
       _logger.severe(e);
+      // ignore: unawaited_futures
       showErrorDialog(
         context,
         context.l10n.oops,
@@ -399,6 +403,7 @@ class UserService {
         Bus.instance.fire(UserDetailsChangedEvent());
         return;
       }
+      // ignore: unawaited_futures
       showErrorDialog(
         context,
         context.l10n.oops,
@@ -407,12 +412,14 @@ class UserService {
     } on DioError catch (e) {
       await dialog.hide();
       if (e.response != null && e.response!.statusCode == 403) {
+        // ignore: unawaited_futures
         showErrorDialog(
           context,
           context.l10n.oops,
           context.l10n.thisEmailIsAlreadyInUse,
         );
       } else {
+        // ignore: unawaited_futures
         showErrorDialog(
           context,
           context.l10n.incorrectCode,
@@ -422,6 +429,7 @@ class UserService {
     } catch (e) {
       await dialog.hide();
       _logger.severe(e);
+      // ignore: unawaited_futures
       showErrorDialog(
         context,
         context.l10n.oops,
@@ -632,6 +640,7 @@ class UserService {
         }
       }
       await dialog.hide();
+      // ignore: unawaited_futures
       Navigator.of(context).pushAndRemoveUntil(
         MaterialPageRoute(
           builder: (BuildContext context) {
@@ -709,6 +718,7 @@ class UserService {
       if (response.statusCode == 200) {
         showShortToast(context, context.l10n.authenticationSuccessful);
         await _saveConfiguration(response);
+        // ignore: unawaited_futures
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
             builder: (BuildContext context) {
@@ -723,6 +733,7 @@ class UserService {
       _logger.severe(e);
       if (e.response != null && e.response!.statusCode == 404) {
         showToast(context, "Session expired");
+        // ignore: unawaited_futures
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
             builder: (BuildContext context) {
@@ -732,6 +743,7 @@ class UserService {
           (route) => route.isFirst,
         );
       } else {
+        // ignore: unawaited_futures
         showErrorDialog(
           context,
           context.l10n.incorrectCode,
@@ -741,6 +753,7 @@ class UserService {
     } catch (e) {
       await dialog.hide();
       _logger.severe(e);
+      // ignore: unawaited_futures
       showErrorDialog(
         context,
         context.l10n.oops,
@@ -760,6 +773,7 @@ class UserService {
         },
       );
       if (response.statusCode == 200) {
+        // ignore: unawaited_futures
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
             builder: (BuildContext context) {
@@ -777,6 +791,7 @@ class UserService {
       _logger.severe(e);
       if (e.response != null && e.response!.statusCode == 404) {
         showToast(context, context.l10n.sessionExpired);
+        // ignore: unawaited_futures
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
             builder: (BuildContext context) {
@@ -786,6 +801,7 @@ class UserService {
           (route) => route.isFirst,
         );
       } else {
+        // ignore: unawaited_futures
         showErrorDialog(
           context,
           context.l10n.oops,
@@ -794,6 +810,7 @@ class UserService {
       }
     } catch (e) {
       _logger.severe(e);
+      // ignore: unawaited_futures
       showErrorDialog(
         context,
         context.l10n.oops,
@@ -853,6 +870,7 @@ class UserService {
           context.l10n.twofactorAuthenticationSuccessfullyReset,
         );
         await _saveConfiguration(response);
+        // ignore: unawaited_futures
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
             builder: (BuildContext context) {
@@ -866,6 +884,7 @@ class UserService {
       _logger.severe(e);
       if (e.response != null && e.response!.statusCode == 404) {
         showToast(context, "Session expired");
+        // ignore: unawaited_futures
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
             builder: (BuildContext context) {
@@ -875,6 +894,7 @@ class UserService {
           (route) => route.isFirst,
         );
       } else {
+        // ignore: unawaited_futures
         showErrorDialog(
           context,
           context.l10n.oops,
@@ -883,6 +903,7 @@ class UserService {
       }
     } catch (e) {
       _logger.severe(e);
+      // ignore: unawaited_futures
       showErrorDialog(
         context,
         context.l10n.oops,
@@ -925,7 +946,7 @@ class UserService {
           "isEnabled": isEnabled,
         },
       );
-      _preferences.setBool(kIsEmailMFAEnabled, isEnabled);
+      await _preferences.setBool(kIsEmailMFAEnabled, isEnabled);
     } catch (e) {
       _logger.severe("Failed to update email mfa", e);
       rethrow;

+ 1 - 1
auth/lib/ui/account/delete_account_page.dart

@@ -236,7 +236,7 @@ class DeleteAccountPage extends StatelessWidget {
         ),
       ],
     );
-
+    // ignore: unawaited_futures
     showDialog(
       context: context,
       builder: (BuildContext context) {

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

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

+ 1 - 0
auth/lib/ui/account/logout_dialog.dart

@@ -23,6 +23,7 @@ Future<void> autoLogoutAlert(BuildContext context) async {
           int pendingSyncCount =
               await AuthenticatorDB.instance.getNeedSyncCount();
           if (pendingSyncCount > 0) {
+            // ignore: unawaited_futures
             showChoiceActionSheet(
               context,
               title: l10n.pendingSyncs,

+ 6 - 1
auth/lib/ui/account/password_entry_page.dart

@@ -399,6 +399,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
     } catch (e, s) {
       _logger.severe(e, s);
       await dialog.hide();
+      // ignore: unawaited_futures
       showGenericErrorDialog(context: context);
     }
   }
@@ -446,6 +447,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
           await UserService.instance.setAttributes(result);
           await dialog.hide();
           Configuration.instance.resetVolatilePassword();
+          // ignore: unawaited_futures
           Navigator.of(context).pushAndRemoveUntil(
             MaterialPageRoute(
               builder: (BuildContext context) {
@@ -457,10 +459,11 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
         } catch (e, s) {
           _logger.severe(e, s);
           await dialog.hide();
+          // ignore: unawaited_futures
           showGenericErrorDialog(context: context);
         }
       }
-
+      // ignore: unawaited_futures
       routeToPage(
         context,
         RecoveryKeyPage(
@@ -476,12 +479,14 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
       _logger.severe(e);
       await dialog.hide();
       if (e is UnsupportedError) {
+        // ignore: unawaited_futures
         showErrorDialog(
           context,
           context.l10n.insecureDevice,
           context.l10n.sorryWeCouldNotGenerateSecureKeysOnThisDevicennplease,
         );
       } else {
+        // ignore: unawaited_futures
         showGenericErrorDialog(context: context);
       }
     }

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

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

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

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

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

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

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

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

+ 2 - 0
auth/lib/ui/account/verify_recovery_page.dart

@@ -92,6 +92,7 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
       String recoveryKey;
       try {
         recoveryKey = Sodium.bin2hex(Configuration.instance.getRecoveryKey());
+        // ignore: unawaited_futures
         routeToPage(
           context,
           RecoveryKeyPage(
@@ -104,6 +105,7 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
           ),
         );
       } catch (e) {
+        // ignore: unawaited_futures
         showGenericErrorDialog(context: context);
         return;
       }

+ 2 - 1
auth/lib/ui/code_widget.dart

@@ -356,6 +356,7 @@ class _CodeWidgetState extends State<CodeWidget> {
     await FlutterClipboard.copy(content);
     showToast(context, confirmationMessage);
     if (Platform.isAndroid && shouldMinimizeOnCopy) {
+      // ignore: unawaited_futures
       MoveToBackground.moveTaskToBack();
     }
   }
@@ -385,7 +386,7 @@ class _CodeWidgetState extends State<CodeWidget> {
       ),
     );
     if (code != null) {
-      CodeStore.instance.addCode(code);
+      await CodeStore.instance.addCode(code);
     }
   }
 

+ 1 - 0
auth/lib/ui/common/progress_dialog.dart

@@ -146,6 +146,7 @@ class ProgressDialog {
     try {
       if (!_isShowing) {
         _dialog = _Body();
+        // ignore: unawaited_futures
         showDialog<dynamic>(
           context: _context!,
           barrierDismissible: _barrierDismissible,

+ 3 - 2
auth/lib/ui/home_page.dart

@@ -120,7 +120,7 @@ class _HomePageState extends State<HomePage> {
       ),
     );
     if (code != null) {
-      CodeStore.instance.addCode(code);
+      await CodeStore.instance.addCode(code);
       // Focus the new code by searching
       if (_codes.length > 2) {
         _focusNewCode(code);
@@ -137,7 +137,7 @@ class _HomePageState extends State<HomePage> {
       ),
     );
     if (code != null) {
-      CodeStore.instance.addCode(code);
+      await CodeStore.instance.addCode(code);
     }
   }
 
@@ -151,6 +151,7 @@ class _HomePageState extends State<HomePage> {
           return false;
         }
         if (Platform.isAndroid) {
+          // ignore: unawaited_futures
           MoveToBackground.moveTaskToBack();
           return false;
         } else {

+ 3 - 0
auth/lib/ui/settings/about_section_widget.dart

@@ -36,6 +36,7 @@ class AboutSectionWidget extends StatelessWidget {
           trailingIcon: Icons.chevron_right_outlined,
           trailingIconIsMuted: true,
           onTap: () async {
+            // ignore: unawaited_futures
             launchUrl(Uri.parse("https://github.com/ente-io/ente"));
           },
         ),
@@ -68,6 +69,7 @@ class AboutSectionWidget extends StatelessWidget {
                           await UpdateService.instance.shouldUpdate();
                       await dialog.hide();
                       if (shouldUpdate) {
+                        // ignore: unawaited_futures
                         showDialog(
                           context: context,
                           builder: (BuildContext context) {
@@ -115,6 +117,7 @@ class AboutMenuItemWidget extends StatelessWidget {
       trailingIcon: Icons.chevron_right_outlined,
       trailingIconIsMuted: true,
       onTap: () async {
+        // ignore: unawaited_futures
         Navigator.of(context).push(
           MaterialPageRoute(
             builder: (BuildContext context) {

+ 5 - 0
auth/lib/ui/settings/account_section_widget.dart

@@ -48,6 +48,7 @@ class AccountSectionWidget extends StatelessWidget {
             l10n.authToChangeYourEmail,
           );
           if (hasAuthenticated) {
+            // ignore: unawaited_futures
             showDialog(
               context: context,
               builder: (BuildContext context) {
@@ -74,6 +75,7 @@ class AccountSectionWidget extends StatelessWidget {
             l10n.authToChangeYourPassword,
           );
           if (hasAuthenticated) {
+            // ignore: unawaited_futures
             Navigator.of(context).push(
               MaterialPageRoute(
                 builder: (BuildContext context) {
@@ -106,9 +108,11 @@ class AccountSectionWidget extends StatelessWidget {
               recoveryKey =
                   Sodium.bin2hex(Configuration.instance.getRecoveryKey());
             } catch (e) {
+              // ignore: unawaited_futures
               showGenericErrorDialog(context: context);
               return;
             }
+            // ignore: unawaited_futures
             routeToPage(
               context,
               RecoveryKeyPage(
@@ -142,6 +146,7 @@ class AccountSectionWidget extends StatelessWidget {
         trailingIcon: Icons.chevron_right_outlined,
         trailingIconIsMuted: true,
         onTap: () async {
+          // ignore: unawaited_futures
           routeToPage(context, const DeleteAccountPage());
         },
       ),

+ 2 - 1
auth/lib/ui/settings/app_update_dialog.dart

@@ -174,6 +174,7 @@ class _ApkDownloaderDialogState extends State<ApkDownloaderDialog> {
         );
       }
       Navigator.of(context, rootNavigator: true).pop('dialog');
+      // ignore: unawaited_futures
       OpenFilex.open(_saveUrl);
     } catch (e) {
       Logger("ApkDownloader").severe(e);
@@ -214,7 +215,7 @@ class _ApkDownloaderDialogState extends State<ApkDownloaderDialog> {
           ),
         ],
       );
-
+      // ignore: unawaited_futures
       showDialog(
         context: context,
         builder: (BuildContext context) {

+ 1 - 0
auth/lib/ui/settings/danger_section_widget.dart

@@ -46,6 +46,7 @@ class DangerSectionWidget extends StatelessWidget {
           trailingIcon: Icons.chevron_right_outlined,
           trailingIconIsMuted: true,
           onTap: () async {
+            // ignore: unawaited_futures
             routeToPage(context, const DeleteAccountPage());
           },
         ),

+ 1 - 0
auth/lib/ui/settings/data/data_section_widget.dart

@@ -35,6 +35,7 @@ class DataSectionWidget extends StatelessWidget {
         trailingIcon: Icons.chevron_right_outlined,
         trailingIconIsMuted: true,
         onTap: () async {
+          // ignore: unawaited_futures
           routeToPage(context, ImportCodePage());
         },
       ),

+ 1 - 1
auth/lib/ui/settings/data/export_widget.dart

@@ -98,7 +98,7 @@ Future<void> _requestForEncryptionPassword(
             ),
           );
           // get json value of data
-          _exportCodes(context, jsonEncode(data.toJson()));
+          await _exportCodes(context, jsonEncode(data.toJson()));
         } catch (e, s) {
           Logger("ExportWidget").severe(e, s);
           showToast(context, "Error while exporting codes.");

+ 1 - 0
auth/lib/ui/settings/data/import/google_auth_import.dart

@@ -56,6 +56,7 @@ Future<void> showGoogleAuthInstruction(BuildContext context) async {
         await CodeStore.instance.addCode(code, shouldSync: false);
       }
       unawaited(AuthenticatorService.instance.onlineSync());
+      // ignore: unawaited_futures
       importSuccessDialog(context, codes.length);
     }
   }

+ 8 - 8
auth/lib/ui/settings/data/import/import_service.dart

@@ -19,29 +19,29 @@ class ImportService {
   Future<void> initiateImport(BuildContext context, ImportType type) async {
     switch (type) {
       case ImportType.plainText:
-        showImportInstructionDialog(context);
+        await showImportInstructionDialog(context);
         break;
       case ImportType.encrypted:
-        showEncryptedImportInstruction(context);
+        await showEncryptedImportInstruction(context);
         break;
       case ImportType.ravio:
-        showRaivoImportInstruction(context);
+        await showRaivoImportInstruction(context);
         break;
       case ImportType.googleAuthenticator:
-        showGoogleAuthInstruction(context);
+        await showGoogleAuthInstruction(context);
         // showToast(context, 'coming soon');
         break;
       case ImportType.aegis:
-        showAegisImportInstruction(context);
+        await showAegisImportInstruction(context);
         break;
       case ImportType.twoFas:
-        show2FasImportInstruction(context);
+        await show2FasImportInstruction(context);
         break;
       case ImportType.bitwarden:
-        showBitwardenImportInstruction(context);
+        await showBitwardenImportInstruction(context);
         break;
       case ImportType.lastpass:
-        showLastpassImportInstruction(context);
+        await showLastpassImportInstruction(context);
         break;
     }
   }

+ 1 - 1
auth/lib/ui/settings/data/import_page.dart

@@ -105,7 +105,7 @@ class ImportCodePage extends StatelessWidget {
                               index != importOptions.length - 1,
                           isTopBorderRadiusRemoved: index != 0,
                           onTap: () async {
-                            ImportService().initiateImport(context, type);
+                            await ImportService().initiateImport(context, type);
                             // routeToPage(context, ImportCodePage());
                             // _showImportInstructionDialog(context);
                           },

+ 1 - 0
auth/lib/ui/settings/developer_settings_page.dart

@@ -61,6 +61,7 @@ class _DeveloperSettingsPageState extends State<DeveloperSettingsPage> {
                     throw const FormatException();
                   }
                 } catch (e) {
+                  // ignore: unawaited_futures
                   showErrorDialog(
                     context,
                     context.l10n.invalidEndpoint,

+ 1 - 0
auth/lib/ui/settings/general_section_widget.dart

@@ -48,6 +48,7 @@ class _AdvancedSectionWidgetState extends State<AdvancedSectionWidget> {
           trailingIconIsMuted: true,
           onTap: () async {
             final locale = await getLocale();
+            // ignore: unawaited_futures
             routeToPage(
               context,
               LanguageSelectorPage(

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

@@ -116,6 +116,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
               context.l10n.authToViewYourActiveSessions,
             );
             if (hasAuthenticated) {
+              // ignore: unawaited_futures
               Navigator.of(context).push(
                 MaterialPageRoute(
                   builder: (BuildContext context) {

+ 1 - 0
auth/lib/ui/settings/social_section_widget.dart

@@ -81,6 +81,7 @@ class SocialsMenuItemWidget extends StatelessWidget {
       trailingIcon: Icons.chevron_right_outlined,
       trailingIconIsMuted: true,
       onTap: () async {
+        // ignore: unawaited_futures
         launchUrlString(
           url,
           mode: launchInExternalApp

+ 2 - 0
auth/lib/ui/settings/support_section_widget.dart

@@ -42,6 +42,7 @@ class _SupportSectionWidgetState extends State<SupportSectionWidget> {
           trailingIcon: Icons.chevron_right_outlined,
           trailingIconIsMuted: true,
           onTap: () async {
+            // ignore: unawaited_futures
             showModalBottomSheet<void>(
               backgroundColor: Theme.of(context).colorScheme.background,
               barrierColor: Colors.black87,
@@ -61,6 +62,7 @@ class _SupportSectionWidgetState extends State<SupportSectionWidget> {
           trailingIcon: Icons.chevron_right_outlined,
           trailingIconIsMuted: true,
           onTap: () async {
+            // ignore: unawaited_futures
             launchUrlString(
               githubDiscussionsUrl,
               mode: LaunchMode.externalApplication,

+ 1 - 1
auth/lib/ui/tools/lock_screen.dart

@@ -56,7 +56,7 @@ class _LockScreenState extends State<LockScreen> with WidgetsBindingObserver {
                     text: context.l10n.unlock,
                     iconData: Icons.lock_open_outlined,
                     onTap: () async {
-                      _showLockScreen(source: "tapUnlock");
+                      await _showLockScreen(source: "tapUnlock");
                     },
                   ),
                 ),

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

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

+ 3 - 1
auth/lib/utils/email_util.dart

@@ -62,6 +62,7 @@ Future<void> sendLogs(
         ],
       ),
       onPressed: () async {
+        // ignore: unawaited_futures
         showDialog(
           context: context,
           builder: (BuildContext context) {
@@ -118,6 +119,7 @@ Future<void> sendLogs(
       ),
     ),
   );
+  // ignore: unawaited_futures
   showDialog(
     context: context,
     builder: (_) {
@@ -159,7 +161,7 @@ Future<String> getZippedLogsFile(BuildContext context) async {
       tempPath + "/logs-${Configuration.instance.getUserID() ?? 0}.zip";
   final encoder = ZipFileEncoder();
   encoder.create(zipFilePath);
-  encoder.addDirectory(logsDirectory);
+  await encoder.addDirectory(logsDirectory);
   encoder.close();
   await dialog.hide();
   return zipFilePath;

+ 4 - 4
auth/lib/utils/toast_util.dart

@@ -2,14 +2,14 @@ import 'package:ente_auth/ente_theme_data.dart';
 import 'package:flutter/material.dart';
 import 'package:fluttertoast/fluttertoast.dart';
 
-Future showToast(
+void showToast(
   BuildContext context,
   String message, {
   toastLength = Toast.LENGTH_LONG,
   iOSDismissOnTap = true,
 }) async {
   await Fluttertoast.cancel();
-  return Fluttertoast.showToast(
+  await Fluttertoast.showToast(
     msg: message,
     toastLength: toastLength,
     gravity: ToastGravity.BOTTOM,
@@ -20,6 +20,6 @@ Future showToast(
   );
 }
 
-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);
 }