ObservableProperty<T> class

Constructors

ObservableProperty(T _value, { T observe(), Duration interval, String name: ObservableProperty._DEFAULT_NAME, bool observeViaTimer: true, bool treatAsDouble: false, FormatObservedValue<T> formatter })
_value The observed value observe Function in parent to observe special values interval Check-Interval name is useful for debugging. If you set this name and if you set your loglevel to "info" it you should see a log output if this object fires a PropertyChangeEvent [...]

Properties

onChange → Stream<PropertyChangeEvent<T>>
read-only
value ↔ T
Sets the internal value and emits a PropertyChangeEvent [...]
read / write
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

observes(T observe()) → void
Observe values in your app Sample: final ObservableProperty nrOfItems = new ObservableProperty(""); ... nrOfItems.observes( () => items.length > 0 ? items.length.toString() : ""); [...]
onFormat(FormatObservedValue callback) → void
Called before toString to convert the internal value to String
onReset(ResetObserver<T> callback) → void
Defines a callback that is called if reset is called [...]
onStaticCast(StaticCast<T> callback) → void
If the input value for value can not be converted to T this callback is called for conversion
pause() → void
Pauses the checks - no further observation. Observing can be restarted via run
reset() → T
Whatever reset should do can be defined in CTOR or by defining the resetCallback
run() → void
Continues with the checks. Manually calling this function is only necessary after pause
toBool() → bool
Converts value to bool. If value is a String, "true", "on", "1" are valid boolean values
toString() → String
Returns a string representation of this object.
update({bool force: false }) → void
Sets the value via callback See observes [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited

Operators

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