extend-equatable
added in: 1.2.0
warning
Warns when a class that matches the config does not extend Equatable
.
Use class-name-pattern
configuration, to filter class names that need to extend Equatable
.
Use file-name-pattern
configuration, to filter file names with classes that need to extend Equatable
.
⚙️ Config example
dart_code_metrics:
...
rules:
...
- extend-equatable:
class-name-pattern: State$
file-name-pattern: '*.model.dart'
Example
❌ Bad:
// LINT
class SomePerson {
const SomePerson(this.name);
final String name;
}
✅ Good:
class SomePerson extends Equatable {
const SomePerson(this.name);
final String name;
List<Object> get props => [name];
}