ソースを参照

NullSafety: Migrate MagicUtil

Neeraj Gupta 2 年 前
コミット
e2c2feab44
1 ファイル変更5 行追加7 行削除
  1. 5 7
      lib/utils/magic_util.dart

+ 5 - 7
lib/utils/magic_util.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:logging/logging.dart';
 import 'package:path/path.dart';
@@ -130,7 +128,7 @@ Future<bool> editFilename(
 }
 
 Future<bool> editFileCaption(
-  BuildContext context,
+  BuildContext? context,
   File file,
   String caption,
 ) async {
@@ -152,7 +150,7 @@ Future<bool> editFileCaption(
 }
 
 Future<void> _updatePublicMetadata(
-  BuildContext context,
+  BuildContext? context,
   List<File> files,
   String key,
   dynamic value, {
@@ -161,7 +159,7 @@ Future<void> _updatePublicMetadata(
   if (files.isEmpty) {
     return;
   }
-  ProgressDialog dialog;
+  ProgressDialog? dialog;
   if (context != null) {
     dialog = createProgressDialog(context, 'Please wait...');
     await dialog.show();
@@ -173,7 +171,7 @@ Future<void> _updatePublicMetadata(
       if (showDoneToast) {
         showShortToast(context, 'Done');
       }
-      await dialog.hide();
+      await dialog?.hide();
     }
 
     if (_shouldReloadGallery(key)) {
@@ -182,7 +180,7 @@ Future<void> _updatePublicMetadata(
   } catch (e, s) {
     _logger.severe("failed to update $key = $value", e, s);
     if (context != null) {
-      await dialog.hide();
+      await dialog?.hide();
     }
     rethrow;
   }