Lazy initialization is now part of dart from the release 2.12 . Simply add late modifier to the variable declaration. late MyClass obj = MyClass(); And this object will be initialized only when it is first used.
Lazy initialization is now part of dart from the release 2.12 . Simply add late modifier to the variable declaration. late MyClass obj = MyClass(); And this object will be initialized only when it is first used.