subscribeWithPrevious<A> method
void Function()
subscribeWithPrevious<A>(})
Listen to changes of an atom's state, and retrieve the latest value.
Implementation
void Function() subscribeWithPrevious<A>(
Atom<A> atom,
void Function(A? previous, A value) handler, {
bool fireImmediately = false,
}) {
final node = _ensureNode(atom);
A? previousValue = node._value;
return subscribe(atom, (A nextValue) {
handler(previousValue, nextValue);
previousValue = nextValue;
}, fireImmediately: fireImmediately);
}