According to the documentation of the Equatable package:
Equatable is designed to only work with immutable objects so all member variables must be final (This is not just a feature of
Equatable
- overriding ahashCode
with a mutable value can break hash-based collections).
However, the book has used the package in non immutable classes, like this:
// ignore: must_be_immutable
class Ingredient extends Equatable {
int? id;
int? recipeId;
final String? name;
final double? weight;
Ingredient({this.id, this.recipeId, this.name, this.weight});
@override
List<Object?> get props => [recipeId, name, weight];
}
Notice that I had to add ignore: must_be_immutable
to make the linter happy.
Should there be a word or two in this regard within the book?