AtomEffect
Auxiliary function to listen to changes in one or more Atom.
This was the old way of listening to the effects of reactivities, and using the
hook useAtomEffect() will always be the best option, as it handles the
life cycle automatically.
However, we maintain this API to help in some very specific cases, such as
unit tests.
final disposer = atomEffect(
(get) => get(counterState),
(state) => print('Number is $state'),
);
// release
disposer();