finds.dev← search

// the find

felangel/equatable

★ 1,089 · Dart · MIT · updated Sep 2026

A Dart package that helps to implement value based equality without needing to explicitly override == and hashCode.

Equatable is a small Dart package that gives classes value equality by having you list the fields that matter in a `props` getter, replacing hand-written `==` and `hashCode`. It is aimed at Dart and Flutter developers who model state or data classes and want equality without a code generation step in their build.

- The API is one `props` getter, and the implementation is three files under lib/src, so you can read all of it in one sitting. Nothing sits behind a build step or a generator.

- Const constructors still work, and the mixin route covers classes that already have a superclass, such as the README's DateTime example, where extending Equatable is not an option.

- `stringify` is opt-in per class or globally through EquatableConfig, and it defaults to on in debug builds. Logs and test failures show field values instead of 'Instance of Person'.

- Nothing checks that `props` covers every field. Add a field, forget to list it, and two objects that differ only in that field compare equal. The compiler will not flag it, and generated code would have made it impossible.

- Immutability is a documented requirement, not an enforced one. A mutable field in `props` breaks hash-based collections without any error, and the README note is the only guard.

- The mixin pattern depends on every subclass level remembering `...super.props`. The README example gets it right, but a subclass that drops the spread still compiles and quietly compares wrong.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →