designedWithLifecycle abstract method

Spec<T> designedWithLifecycle({
  1. bool lazy = false,
  2. List<String> initMethods = const [],
  3. List<String> destroyMethods = const [],
  4. bool enforceInitMethod = false,
  5. bool enforceDestroyMethod = false,
})

Configures lifecycle design for the pod.

Parameters:

  • lazy: Whether initialization should be deferred until first access.
  • initMethods: List of method names to call during initialization.
  • destroyMethods: List of method names to call during destruction.
  • enforceInitMethod: Enforces that init methods exist on the class.
  • enforceDestroyMethod: Enforces that destroy methods exist on the class.

Example

spec.designedWithLifecycle(
  lazy: true,
  initMethods: ['init'],
  destroyMethods: ['dispose'],
  enforceInitMethod: true,
);

Implementation

Spec<T> designedWithLifecycle({
  bool lazy = false,
  List<String> initMethods = const [],
  List<String> destroyMethods = const [],
  bool enforceInitMethod = false,
  bool enforceDestroyMethod = false,
});