Property<T> class
Class implementing property functionality.
A property is a combination of a value and a signal.
The property is useful when the model of the widget is too small.
In that case creating a property will be shorter.
Property contains a Property.changed signal which is emitted
automatically after setting Property.value or Property.update.
It is best to use this in combination with Watcher.
Mutable Objects
For primitive types (int, String, bool), simply setting .value works.
For mutable objects (List, custom classes), use update to modify the object
and trigger a notification.
// Primitive
count.value = 5;
// Mutable
listProperty.update((list) => list.add(item));
Constructors
- Property(T value)
Properties
- changed → Signal
-
This signal is emitted when the property is changed.
Generally not intended to be used directly.
If it is required to do something when the property changes,
connect to this signal an appropriate slot.
Don't forget to disconnect the slot when not needed anymore.
See the Watcher for usage examples.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ T
-
Returns the value of the property.
getter/setter pair
Methods
-
call(
) → T - Returns the value of the property. Same as the getter value.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
void updateFn(T value)) → void - Updates value when it is a mutable object.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited