get<StateT> method

StateT get<StateT>(
  1. ProviderListenable<StateT> listenable
)

Reads the current state of a listenable and keeps it alive until the enclosing mutation completes.

Implementation

StateT get<StateT>(ProviderListenable<StateT> listenable) {
  assert(
    !_closed,
    'Cannot access MutationTransaction after the mutation has completed',
  );

  final sub = _container.listen<StateT>(listenable, (_, _) {});
  _subscriptions.add(sub as ProviderSubscription<Object?>);
  return sub.read();
}