Var<T> class
A simple mutable wrapper for holding and updating a value.
Var<T> is useful when you need to pass a primitive (like an int or bool)
by reference to a callback or closure, allowing its state to be mutated cleanly.
Constructors
- Var(T value)
-
Creates a new
Varholding the givenvalue.
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ T
-
The underlying value held by this variable.
getter/setter pair
Methods
-
call(
) → T - Returns the current value implicitly when called as a function.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
update(
T updater(T current)) → void - Utility functionally updating the value safely.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override