MutableLazy<T> class

Lazily creates T when needed. gets notified by a reset() call that something has been modified and it needs to re-create the value.

var number = 1;
var mutableLazy = MutableLazy(() => number * 3);
print(mutableLazy.value); // 3
number = 2;
mutableLazy.reset();
print(mutableLazy.value); // 6
Inheritance

Constructors

MutableLazy(InitFunction<T> function)
for each initialization, the function specified here gets used and creates the value.

Properties

hashCode int
The hash code for this object.
no setterinherited
isValueCreated bool
Returns true if the value has been created and cached.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T
the lazily initialized value.
no setterinherited

Methods

call() → T
Returns the lazily initialized value.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Notifies the Lazy object that something that was used in the init function has been changed and it needs to re-initialize next time it tries to get the value.
toString() String
A string representation of this object.
inherited

Operators

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