FieldControl<T> class

Stream based version of ObservableModel.

Inheritance
Available extensions

Constructors

FieldControl([T? value])
Stream centric version of ObservableModel.
FieldControl.of(Stream stream, {T? initValue, Function? onError, void onDone()?, bool cancelOnError = false, ValueConverter<T>? converter})
Initializes FieldControl and subscribes it to given stream. Check subscribeTo function for more info.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
internalData ↔ dynamic
Serves for internal data or marker. Exposed to public API due to usage as custom 'client' data.
getter/setter pairinherited
isActive bool
Checks if Stream is not closed.
no setteroverride
isClosed bool
Returns true if current stream is closed.
no setter
isEmpty bool
Checks if value is not set.
no setterinherited
isFalse bool

Available on ObservableModel<bool>, provided by the ObservableBoolExt extension

Checks if value is 'false' or 'null'.
no setter
isNotEmpty bool
Checks if value is set.
no setterinherited
isTrue bool

Available on ObservableModel<bool>, provided by the ObservableBoolExt extension

Checks if value is 'true'.
no setter
isValid bool
Checks validity of this observable. Invalid observers should not be notified.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sink Sink<T>
Default sink of this controller. Use sinkConverter to convert input data.
no setter
stream Stream<T?>
no setter
value ↔ T?
Current value of this observable.
getter/setter pairinherited-setteroverride-getter

Methods

cancel(ControlSubscription subscription) → void
Cancels given subscription.
override
cast<U>() ObservableValue<U>

Available on ObservableValue, provided by the ObservableValuExt extension

Cast this observable.
dispose() → void
Used to clear and dispose object. Unsubscribe and close all sources. Prepare object for GC. Can be called multiple times!
override
disposeWith(DisposeObserver observer) → void

Available on Disposable, provided by the DisposableExt extension

Register for dispose with given observer.
listen(VoidCallback action) ControlSubscription<T?>
Subscribe to listen future changes. Returns ControlSubscription for later connection close.
inherited
merge(Object other) ObservableGroup

Available on ObservableBase, provided by the ObservableBaseExt extension

Creates new group, that listens to both observables.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify() → void
Notifies current Stream.
override
onFuture(Future future, {ValueConverter? converter}) Future
Sets value after future finishes. Via ValueConverter is possible to convert object from input Stream type to own stream value. Returns Future to await and register other callbacks.
setFalse() → void

Available on ObservableModel<bool>, provided by the ObservableBoolExt extension

Sets value to 'false'. Listeners are notified if value is changed.
setTrue() → void

Available on ObservableModel<bool>, provided by the ObservableBoolExt extension

Sets value to 'true'. Listeners are notified if value is changed.
setValue(T? value, {bool notify = true, bool forceNotify = false}) → void
Robust value setter. notify when set is called when value is different. Disable notify to prevent propagation of this value change. This can be handy when we change value multiple times during one function call and we want to notify just last change. Enable forceNotify to notify listeners even if value is not changed.
override
sinkConverter(ValueConverter<T> converter) Sink
Returns Sink with custom ValueConverter.
softDispose() → void
Clears subscribers, but didn't close Stream entirely.
subscribe(ValueCallback<T?> action, {bool current = true, dynamic args}) FieldSubscription<T>
override
subscribeStream(void onData(T? event), {Function? onError, void onDone()?, bool cancelOnError = false, bool current = true}) FieldSubscription<T>
subscribeTo(Stream stream, {Function? onError, void onDone()?, bool cancelOnError = false, ValueConverter? converter}) FieldSubscription
Subscribes this field to given Stream. Controller will subscribe to input stream and will listen for changes and populate this changes into own stream. Via ValueConverter is possible to convert object from input Stream type to own stream value. StreamSubscription is automatically closed during dispose phase of FieldControl. Returns FieldSubscription for manual cancellation.
toggle() bool

Available on ObservableModel<bool>, provided by the ObservableBoolExt extension

Toggles current value and notifies listeners. 'true' -> 'false' 'false' -> 'true'
toString() String
A string representation of this object.
override

Operators

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