Lazy<T> class
A class that caches an object of type T
.
The cache is populated when the object is first accessed.
Constructors
-
Lazy(ObjectFactory<
T> objectFactory) - Constructs a lazy object.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isUpToDate → bool
-
Returns
true
if the cached object has been initialized and is up-to-date.no setter -
objectFactory
→ ObjectFactory<
T> -
Callback used to create the cached object.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
{bool updateCache = false}) → T - Returns the cached object.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
updateCache(
) → void - After calling this function the cached object will be (lazily) re-initialized when it is next accessed.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited