Lazy<T> class
A class that provides lazy initialization for a value of type T
.
The value is created by a factory function the first time it is needed.
Optionally, the value can expire based on a duration or a custom condition,
which will trigger the recreation of the value upon the next access.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isInitialized → bool
-
Returns
true
if the value has been initialized, otherwisefalse
.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → T
-
Returns the current value, creating it if necessary. If the value is determined to be expired
either by time or a custom condition, it is recreated. This check happens each time the value is accessed.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void - Resets the value, causing it to be re-created upon next access. If a destruction callback is provided, it is invoked with the current value before resetting.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited