get<StateT> method
Reads the current state of a listenable and maintains a subscription to it until the transaction completes.
Note: Updates to the listenable during the transaction are ignored.
Implementation
StateT get<StateT>(ProviderListenable<StateT> listenable) {
assert(
!_closed,
'Cannot get a listenable after the transaction has been closed',
);
final sub = _container.listen(
listenable,
(previous, next) {},
onError: (error, stackTrace) {},
);
_subscriptions.add(sub);
return sub.readSafe().valueOrProviderException;
}