ADR-003: Support equatable 2.x and 3.x
Status: Accepted for 3.0.1
Date: 2026-10-16
Relates to: ADR-001 (D21). This supersedes the equatable part of D21; the
state_notifier part stands.
Context
Section titled “Context”pub.dev scores a package on whether all its dependencies support their latest
versions. equatable: ^2.0.5 excluded 3.0.0 (published 2026-09-15). D21 kept
2.x because 3.0.0 was believed to stop comparing runtimeType, which would make
two distinct state classes with equal props equal and skip their transition.
Decision
Section titled “Decision”Declare equatable: '>=2.0.5 <4.0.0'. JState and JEquatable keep extending
the Equatable class, so state equality does not change.
Evidence (verified 2026-10-16)
Section titled “Evidence (verified 2026-10-16)”- The
Equatableclass in 3.0.0 still comparesruntimeTypein==and uses it inhashCode. Its changelog lists the removal ofEquatableMixin, which JIntent does not use. The premise of D21 was a misreading of that changelog. - A test with 3.0.0 resolved: empty-props
InitialandLoadingstates are not equal, andupdatefrom one to the other notifies listeners. The same test passes with 2.x. It is now part oftest/src/core/jstate_test.dart. - The library’s tests and the analyzer pass on Flutter 3.29.2 and 3.47.6 with
equatable3.0.0 and with the lowest allowed version, 2.0.5.
Consequences
Section titled “Consequences”- Applications on
equatable2.x keep working, and applications on 3.x can now resolve JIntent. - An application that mixes
EquatableMixininto its own classes must migrate that code before moving toequatable3.x. That is independent of JIntent. - State equality is defined by
equatable. The regression test fails if a future release changes how distinct state classes compare.