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