updates<Value> method

Stream<Value> updates<Value>(
  1. StoreMapper<Value, State> mapper
)

Stream of new values in state

Using mapper you can select values you want to listen

Stream<StatefulData<List<Post>>?> get postsStream => getLocalInstance<PostsInteractor>().updates((state) => state.posts);

Implementation

Stream<Value> updates<Value>(StoreMapper<Value, State> mapper) {
  if (_isDisposed) {
    throw IllegalStateException(
      message: 'Can\'t call updates after dispose.',
    );
  }

  return _state.stream.where((element) {
    return mapper(element.previous ?? element.next!) !=
        mapper(element.next as State);
  }).map((event) => mapper(event.next as State));
}