소스 검색

Fix prefer_final_locals warnings

Neeraj Gupta 2 년 전
부모
커밋
139e3c7835
5개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 0
      analysis_options.yaml
  2. 1 1
      lib/db/files_db.dart
  3. 1 1
      lib/ui/home/home_gallery_widget.dart
  4. 1 1
      lib/ui/viewer/file/fading_app_bar.dart
  5. 1 1
      lib/ui/viewer/file/fading_bottom_bar.dart

+ 1 - 0
analysis_options.yaml

@@ -55,6 +55,7 @@ analyzer:
     prefer_const_constructors: warning
     prefer_const_declarations: warning
     prefer_const_constructors_in_immutables: warning
+    prefer_final_locals: warning
     unnecessary_const: error
     cancel_subscriptions: error
 

+ 1 - 1
lib/db/files_db.dart

@@ -645,7 +645,7 @@ class FilesDB {
     inParam = inParam.substring(0, inParam.length - 1);
     final db = await instance.database;
     final order = (asc ?? false ? 'ASC' : 'DESC');
-    String whereClause =
+    final String whereClause =
         '$columnCollectionID  IN ($inParam) AND $columnCreationTime >= ? AND '
         '$columnCreationTime <= ? AND $columnOwnerID = ?';
     final List<Object> whereArgs = [startTime, endTime, userID];

+ 1 - 1
lib/ui/home/home_gallery_widget.dart

@@ -27,7 +27,7 @@ class HomeGalleryWidget extends StatelessWidget {
 
   @override
   Widget build(BuildContext context) {
-    double bottomSafeArea = MediaQuery.of(context).padding.bottom;
+    final double bottomSafeArea = MediaQuery.of(context).padding.bottom;
     final gallery = Gallery(
       asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {
         final ownerID = Configuration.instance.getUserID();

+ 1 - 1
lib/ui/viewer/file/fading_app_bar.dart

@@ -505,7 +505,7 @@ class FadingAppBarState extends State<FadingAppBar> {
     await dialog.show();
     try {
       final io.File fileToSave = await getFile(file);
-      var m = MediaExtension();
+      final m = MediaExtension();
       final bool result = await m.setAs("file://${fileToSave.path}", "image/*");
       if (result == false) {
         showShortToast(context, "Something went wrong");

+ 1 - 1
lib/ui/viewer/file/fading_bottom_bar.dart

@@ -91,7 +91,7 @@ class FadingBottomBarState extends State<FadingBottomBar> {
     if (widget.file is TrashFile) {
       _addTrashOptions(children);
     }
-    bool isUploadedByUser = widget.file.uploadedFileID != null &&
+    final bool isUploadedByUser = widget.file.uploadedFileID != null &&
         widget.file.ownerID == Configuration.instance.getUserID();
     bool isFileHidden = false;
     if (isUploadedByUser) {