Lazy<T extends Object> class

A class that provides lazy initialization for instances of type T.

Constructors

Lazy(TConstructor<T> _constructor)

Properties

currentInstance FutureOr<T>?
Holds the current singleton instance of type T or null if no singleton instance was created.
getter/setter pair
factory FutureOr<T>
Returns a new instance of T each time, acting as a factory.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
singleton FutureOr<T>
Returns the singleton instance currentInstance, or creating it if necessary.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetSingleton() → void
Resets the singleton instance, by setting currentInstance back to null allowing it to be re-created via singleton.
toString() String
A string representation of this object.
inherited

Operators

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