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