run<A> method

dynamic run<A>(
  1. State<S, A> state
)

Run the computation and returns a tuple of the result and state.

Implementation

Tuple2<A, S> run<A>(State<S, A> state) {
  final next = state(_state);
  final previous = _state;

  _state = next.second;
  if (_controller != null && !identical(previous, _state)) {
    _controller!.add(_state);
  }

  return next;
}