extend-equatable
added in: 1.2.0
warning
Warns when a class that matches the config does not extend Equatable
.
⚙️ Config
Set class-name-pattern
(default is none) to configure the list of class names that need to extend Equatable
.
Set file-name-pattern
(default is none) to configure the list of file names with classes that need to extend Equatable
.
dart_code_metrics:
...
rules:
...
- extend-equatable:
class-name-pattern: State$
file-name-pattern: '.model.dart'
note
This rule requires configuration in order to highlight any issues.
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];
}