Skip to content

Commit

Permalink
fix: disable unwanted lint rules, revert, add immutable, re-add type
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier committed Oct 28, 2024
1 parent f492e36 commit 577d9e7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
2 changes: 0 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ linter:
cancel_subscriptions: true
directives_ordering: true
eol_at_end_of_file: true
omit_local_variable_types: true
prefer_asserts_in_initializer_lists: true
prefer_const_constructors: true
prefer_final_in_for_each: true
prefer_final_locals: true
prefer_null_aware_method_calls: true
prefer_null_aware_operators: true
sort_constructors_first: true
sort_unnamed_constructors_first: true
sort_pub_dependencies: true
type_annotate_public_apis: true
Expand Down
6 changes: 2 additions & 4 deletions lib/backend/entity_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ limitations under the License.
import 'dart:io';

import 'package:files/backend/database/model.dart';
import 'package:flutter/foundation.dart';

@immutable
class EntityInfo {
const EntityInfo._(this._entity, this.stat, this.entityType);
final FileSystemEntity _entity;
Expand All @@ -40,8 +42,6 @@ class EntityInfo {
}

@override
// TODO(@HrX03): is this correct?
// ignore: avoid_equals_and_hash_code_on_mutable_classes
bool operator ==(Object other) {
if (other is EntityInfo) {
return _equals(other);
Expand All @@ -50,8 +50,6 @@ class EntityInfo {
}

@override
// TODO(@HrX03): is this correct?
// ignore: avoid_equals_and_hash_code_on_mutable_classes
int get hashCode => Object.hash(
entity.path,
stat.accessed,
Expand Down
17 changes: 9 additions & 8 deletions lib/backend/fetch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ enum SortType {
}

class CancelableFsFetch {
final Directory directory;
final ValueChanged<List<EntityInfo>?> onFetched;
final VoidCallback? onCancel;
final ValueChanged<double?>? onProgressChange;
final ValueChanged<OSError?>? onFileSystemException;
final bool ascending;
final SortType sortType;
final bool showHidden;

CancelableFsFetch({
required this.directory,
required this.onFetched,
Expand All @@ -24,14 +33,6 @@ class CancelableFsFetch {
this.sortType = SortType.name,
this.showHidden = false,
});
final Directory directory;
final ValueChanged<List<EntityInfo>?> onFetched;
final VoidCallback? onCancel;
final ValueChanged<double?>? onProgressChange;
final ValueChanged<OSError?>? onFileSystemException;
final bool ascending;
final SortType sortType;
final bool showHidden;

bool _running = false;
Completer<void> cancelableCompleter = Completer<void>();
Expand Down
7 changes: 4 additions & 3 deletions lib/backend/path_parts.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
class PathParts {
const PathParts(this.root, this.parts, this.separator);

final String root;
final List<String> parts;
final String separator;

factory PathParts.parse(String path) {
late final String root;
late final String separator;
Expand All @@ -25,9 +29,6 @@ class PathParts {

return PathParts(root, parts, separator);
}
final String root;
final List<String> parts;
final String separator;

String toPath([int? numOfParts]) {
final resolvedNumOfParts = numOfParts ?? parts.length;
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class FilesTable extends StatelessWidget {
return InkWell(
onTap: column.allowSorting
? () {
var newAscending = ascending;
bool newAscending = ascending;
if (columnIndex == index) {
newAscending = !newAscending;
}
Expand Down

0 comments on commit 577d9e7

Please sign in to comment.