Observable<T> class abstract

A lightweight reactive primitive for observing value changes.

Unlike Dart Streams, observables are synchronous and support operators like map, distinct, and when for declarative transformations.

Obtain an observable from Store.stateObservable or Store.actionObservable.

store.stateObservable
  .map((state) => state.count)
  .distinct()
  .listen((count) => print(count));

Constructors

Observable()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancel(int id) → void
Cancels a subscription by its id, as returned from listen.
distinct([bool isEqual(T a, T b)?]) Observable<T>
Returns an observable that only emits when the value changes according to isEqual (defaults to ==).
listen(OnChangeCallback<T> callback, {bool fireImmediately = true}) int
Subscribes to value changes.
map<R>(R transform(T value)) Observable<R>
Returns an observable that transforms each emitted value using transform.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
when(bool predicate(T value)) Observable<T>
Returns an observable that only emits values satisfying predicate.

Operators

operator ==(Object other) bool
The equality operator.
inherited