Skip to content

Commit 577d9e7

Browse files
committed
fix: disable unwanted lint rules, revert, add immutable, re-add type
1 parent f492e36 commit 577d9e7

File tree

5 files changed

+16
-18
lines changed

5 files changed

+16
-18
lines changed

analysis_options.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ linter:
1111
cancel_subscriptions: true
1212
directives_ordering: true
1313
eol_at_end_of_file: true
14-
omit_local_variable_types: true
1514
prefer_asserts_in_initializer_lists: true
1615
prefer_const_constructors: true
1716
prefer_final_in_for_each: true
1817
prefer_final_locals: true
1918
prefer_null_aware_method_calls: true
2019
prefer_null_aware_operators: true
21-
sort_constructors_first: true
2220
sort_unnamed_constructors_first: true
2321
sort_pub_dependencies: true
2422
type_annotate_public_apis: true

lib/backend/entity_info.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ limitations under the License.
1717
import 'dart:io';
1818

1919
import 'package:files/backend/database/model.dart';
20+
import 'package:flutter/foundation.dart';
2021

22+
@immutable
2123
class EntityInfo {
2224
const EntityInfo._(this._entity, this.stat, this.entityType);
2325
final FileSystemEntity _entity;
@@ -40,8 +42,6 @@ class EntityInfo {
4042
}
4143

4244
@override
43-
// TODO(@HrX03): is this correct?
44-
// ignore: avoid_equals_and_hash_code_on_mutable_classes
4545
bool operator ==(Object other) {
4646
if (other is EntityInfo) {
4747
return _equals(other);
@@ -50,8 +50,6 @@ class EntityInfo {
5050
}
5151

5252
@override
53-
// TODO(@HrX03): is this correct?
54-
// ignore: avoid_equals_and_hash_code_on_mutable_classes
5553
int get hashCode => Object.hash(
5654
entity.path,
5755
stat.accessed,

lib/backend/fetch.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ enum SortType {
1414
}
1515

1616
class CancelableFsFetch {
17+
final Directory directory;
18+
final ValueChanged<List<EntityInfo>?> onFetched;
19+
final VoidCallback? onCancel;
20+
final ValueChanged<double?>? onProgressChange;
21+
final ValueChanged<OSError?>? onFileSystemException;
22+
final bool ascending;
23+
final SortType sortType;
24+
final bool showHidden;
25+
1726
CancelableFsFetch({
1827
required this.directory,
1928
required this.onFetched,
@@ -24,14 +33,6 @@ class CancelableFsFetch {
2433
this.sortType = SortType.name,
2534
this.showHidden = false,
2635
});
27-
final Directory directory;
28-
final ValueChanged<List<EntityInfo>?> onFetched;
29-
final VoidCallback? onCancel;
30-
final ValueChanged<double?>? onProgressChange;
31-
final ValueChanged<OSError?>? onFileSystemException;
32-
final bool ascending;
33-
final SortType sortType;
34-
final bool showHidden;
3536

3637
bool _running = false;
3738
Completer<void> cancelableCompleter = Completer<void>();

lib/backend/path_parts.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
class PathParts {
22
const PathParts(this.root, this.parts, this.separator);
33

4+
final String root;
5+
final List<String> parts;
6+
final String separator;
7+
48
factory PathParts.parse(String path) {
59
late final String root;
610
late final String separator;
@@ -25,9 +29,6 @@ class PathParts {
2529

2630
return PathParts(root, parts, separator);
2731
}
28-
final String root;
29-
final List<String> parts;
30-
final String separator;
3132

3233
String toPath([int? numOfParts]) {
3334
final resolvedNumOfParts = numOfParts ?? parts.length;

lib/widgets/table.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class FilesTable extends StatelessWidget {
171171
return InkWell(
172172
onTap: column.allowSorting
173173
? () {
174-
var newAscending = ascending;
174+
bool newAscending = ascending;
175175
if (columnIndex == index) {
176176
newAscending = !newAscending;
177177
}

0 commit comments

Comments
 (0)