ActionControl<T> class

Strict implementation of ObservableValue based on ControlObservable. ActionControl.single - Only one sub can be active. ActionControl.broadcast - Multiple subs can be used. ActionControl.empty - Null version - one or multiple subs can be used. ActionControl.provider - Subscription to global BroadcastProvider.

Inheritance
Available extensions

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 availability of this observable. Inactive observers should not be notified.
no setterinherited
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 setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subCount int
Number of active listeners.
no setterinherited
subs List<ControlSubscription<T>>
Active subscriptions of this observable. This is exposed just for debug and test purposes. DO NOT modify this list externally!
finalinherited
value ↔ T
Current value of this observable.
getter/setter pairinherited

Methods

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

Available on ObservableValue, provided by the ObservableValuext extension

Cast this observable.
clear() → void
Invalidates and clears all subs.
inherited
createSubscription([dynamic args]) ControlSubscription<T>
inherited
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
Notify this object to propagate changes.
inherited
pause() → void
When observable is paused, then notify breaks all callbacks.
inherited
resume() bool
Resume notify to listeners. Only isValid observable can be resumed.
inherited
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.
inherited
subscribe(ValueCallback<T> action, {bool current = true, dynamic args}) ControlSubscription<T>
override
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

Static Methods

broadcast<T>(T value) ActionControl<T>
Strict implementation of ObservableValue based on ControlObservable. Multiple subs can be used. Check single or empty for different approaches.
empty<T>({T? value, bool broadcast = true}) ActionControl<T?>
Strict implementation of ObservableValue based on ControlObservable. Set broadcast to restrict sub count. Check ActionControl.single, ActionControl.broadcast.
override
provider<T>({dynamic key, T? defaultValue, bool broadcast = true}) ActionControl<T?>
Simplified version of Stream to provide basic and lightweight functionality to notify listeners. This control will subscribe to BroadcastProvider with given key and will listen to Global Stream.
single<T>(T value) ActionControl<T>
Strict implementation of ObservableValue based on ControlObservable. Only one sub can be active. Last given subscribe is held. Check broadcast or empty to support more listeners.