Last updated:
0 purchases
equatable lint ultimate
equatable_lint_ultimate #
This package is based on a fork from the equatable_lint package
This package used the custom_lint package
Table of content #
Table of content
Setup local
Setup CI
All the lints
missing_field_in_equatable_props
always_call_super_props_when_overriding_equatable_props
All the lints fixes
missing_field_in_equatable_props fixes
Add every fields to equatable props
Add field to equatable props
always_call_super_props_when_overriding_equatable_props fixes
Call super in overridden equatable props
All the assists
Make class extend Equatable
Setup local #
In your pubspec.yaml, add these dev_dependencies :
dev_dependencies:
custom_lint:
equatable_lint_ultimate:
copied to clipboard
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
copied to clipboard
Run flutter pub get or dart pub get in your package
Possibly restart your IDE
Setup CI #
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
All the lints #
missing_field_in_equatable_props #
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];
}
copied to clipboard
Bad:
class MyClass extends Equatable {
const MyClass({this.myField});
final String? myField;
@override
List<Object?> get props => [];
}
copied to clipboard
always_call_super_props_when_overriding_equatable_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]);
}
copied to clipboard
Bad:
class MyClass extends RandomClassExtendingEquatable {
const MyClass({this.newField});
final String? newField;
@override
List<Object?> get props => [newField];
}
copied to clipboard
All the lints fixes #
missing_field_in_equatable_props fixes #
Add every fields to equatable props
Add field to equatable props
always_call_super_props_when_overriding_equatable_props fixes #
Call super in overridden equatable props
All the assists #
Make class extend Equatable #
About Tomasz Czajka #
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).
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.