Observable<T> class

Base class for observable object

You can get stream of object changes and also update object data

Example:

void example() {
  final username = Observable<String>.initial("Ted");

  final subscription = username.stream.listen((name) {
    // do something with name
  });

  username.update('John');

  print('current username=${username.current}');

  subscription.cancel();
  username.dispose();
}

Constructors

Observable()
Observable.initial(T initial)
Initializes observable with given initial value

Properties

current → T?
Current value of observable object
no setter
hashCode → int
The hash code for this object.
no setterinherited
isDisposed → bool
Flag indicating that this observable is disposed Observable bus can't be used if this flag is true
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stream → Stream<ObservableChange<T>>
Broadcast stream of current changes
no setter

Methods

dispose() → void
Closes underlaying stream controller
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
update(T data) → void
Updates current field

Operators

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