This package is based on a fork from the equatable_lint package
This package used the custom_lint package
- In your
pubspec.yaml
, add thesedev_dependencies
:
dev_dependencies:
custom_lint:
equatable_lint_ultimate:
- In your
analysis_options.yaml
, add this plugin :
analyzer:
plugins:
- custom_lint
# Optional : Disable unwanted rules
custom_lint:
rules:
- always_call_super_props_when_overriding_equatable_props: false
-
Run
flutter pub get
ordart pub get
in your package -
Possibly restart your IDE
flutter analyze
or dart analyze
don't use this custom rule when checking your code
If you want to analyze your code with this rule in your CI, add a step that run flutter pub run custom_lint
or dart run custom_lint
Class extending Equatable should put every field into equatable props
Good:
class MyClass extends Equatable {
const MyClass({this.myField});
final String? myField;
@override
List<Object?> get props => [myField];
}
Bad:
class MyClass extends Equatable {
const MyClass({this.myField});
final String? myField;
@override
List<Object?> get props => [];
}
Should always call super when overriding equatable props
Good:
class MyClass extends RandomClassExtendingEquatable {
const MyClass({this.newField});
final String? newField;
@override
List<Object?> get props => super.props..addAll([newField]);
}
Bad:
class MyClass extends RandomClassExtendingEquatable {
const MyClass({this.newField});
final String? newField;
@override
List<Object?> get props => [newField];
}
I am deeply committed to ensuring code quality, which is why I have chosen to adopt these wonderful package (as their original authors are no longer reachable).