list-all-equatable-fields
- Group
- Correctness
- Path
lint/correctness/list-all-equatable-fields- Default
- On (recommended)
- Origin
- Falcon
- Domain
- equatable
- Rule
- 256 of 512
Flags declared instance fields omitted from a statically understood Equatable props list.
Only resolved transitive package:equatable Equatable/EquatableMixin subtypes inheriting Equatable's concrete equality are checked; classes replacing equality are excluded. Instance storage includes private and primary-constructor fields, but not static, abstract or external fields or computed getters. Arrow getters and single-return blocks with literal lists are supported, including this.field, super.props spreads and cascaded addAll calls with known lists. Unknown expressions, collection control flow, and unknown spreads are left silent.
Invalid
import 'package:equatable/equatable.dart';
import 'package:equatable/equatable.dart' as eq;
import 'support.dart';
class Direct extends Equatable {
final int value = 1;
List<Object?> get props => [];
}
class MixedValue with EquatableMixin {
final int value = 1;
List<Object?> get props => [];
}
class Indirect extends Middle {
final int child = 1;
List<Object?> get props => [...super.props];
}
class Prefixed extends eq.Equatable {
final int x = 1, y = 2;
List<Object?> get props => [x];
}
class Private extends Mixed {
final int _value = 1;
List<Object?> get props { return []; }
}
class Cascaded extends Parent {
final int value = 1;
List<Object?> get props => super.props..addAll([]);
} final int value = 1; List<Object?> get props => []; final int value = 1; List<Object?> get props => []; final int child = 1; List<Object?> get props => [...super.props]; final int x = 1, y = 2; List<Object?> get props => [x]; final int _value = 1; List<Object?> get props { return []; } final int value = 1; List<Object?> get props => super.props..addAll([]);Valid
import 'package:equatable/equatable.dart';
import 'support.dart';
class Complete extends Equatable {
final int value = 1;
List<Object?> get props => [value];
}
class ExplicitThis with EquatableMixin {
final int value = 1;
List<Object?> get props { return [this.value]; }
}
class StaticOnly extends Parent {
static int ignored = 1;
int get computed => 2;
List<Object?> get props => [...super.props];
}
class UnknownCall extends Parent {
final int value = 1;
List<Object?> values() => [value];
List<Object?> get props => values();
}
class UnknownSpread extends Parent {
final int value = 1;
List<Object?> values() => [value];
List<Object?> get props => [...values()];
}
class Conditional extends Parent {
final int value = 1;
List<Object?> get props => [if (true) value];
}
class CompleteChild extends Middle {
final int child = 1;
List<Object?> get props => [...super.props, child];
}
class Unrelated {
final int value = 1;
List<Object?> get props => [];
}
class Cascaded extends Parent {
final int value = 1;
List<Object?> get props => super.props..addAll([value]);
}
class UnknownCascade extends Parent {
final int value = 1;
List<Object?> values() => [value];
List<Object?> get props => super.props..addAll(values());
}Configure list-all-equatable-fields
Set its severity in falcon.json. See the configuration guide.
{
"linter": {
"rules": {
"correctness": {
"list-all-equatable-fields": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore lint/correctness/list-all-equatable-fields: <reason>More correctness rules
- literal-only-boolean-expressions
literal_only_boolean_expressionsrecommendedFlags conditions built only from literals, whose value never changes.
- match-getter-setter-field-names
Detect likely copy-paste errors in trivial accessors when a different field matching the accessor name is declared.
- missing-test-assertionrecommendedtest
Reports inline test callbacks that contain no recognized assertion calls.
- no-adjacent-strings-in-list
no_adjacent_strings_in_listrecommendedFlags adjacent string literals used as an element of a list or set literal.
- no-import-cyclescross-file
Report mutually dependent components of imported or exported library files.
- no-logic-in-create-state
no_logic_in_create_staterecommendedflutterRequire
StatefulWidget.createStateto return only a fresh zero-argument FlutterStateconstruction. - no-self-assignments
no_self_assignmentsrecommendedFlags assignments of a variable to itself, such as
x = x;. - null-check-on-nullable-type-parameter
null_check_on_nullable_type_parameterrecommendedFlags a null assertion
x!on a nullable type parameterT?whose expected type isTorT?for a potentially nullableT, and null-assert patterns whose matched value is a nullable type parameter.