Lazy constructor

const Lazy([
  1. bool value = true
])

Indicates that a pod should be lazily initialized.

By default, pods are created eagerly at context startup. Applying @Lazy() will delay pod creation until it is first requested, improving startup performance or avoiding unnecessary initialization.

Example

@Lazy()
class ExpensiveService {}

@Lazy(false)
class AlwaysEagerService {}
  • Setting value to true enables lazy initialization (default).
  • Setting value to false disables lazy initialization explicitly.

Implementation

const Lazy([this.value = true]);