LifecycleDesign class

Describes lifecycle behavior of a component, such as initialization and destruction methods.

This class allows you to specify whether the component should be lazy-loaded, which methods should be called at initialization and destruction, and whether those lifecycle methods are enforced.

Example

final lifecycle = LifecycleDesign(
  isLazy: true,
  initMethods: ["initDatabase"],
  destroyMethods: ["closeDatabase"],
  enforceInitMethod: true,
  enforceDestroyMethod: true,
);

print(lifecycle.isLazy); // true
print(lifecycle.initMethods); // ["initDatabase"]

Constructors

LifecycleDesign({bool? isLazy, List<String> initMethods = const [], List<String> destroyMethods = const [], bool enforceInitMethod = true, bool enforceDestroyMethod = true})
Creates a LifecycleDesign with optional lifecycle configurations.

Properties

destroyMethods List<String>
Methods to be executed when the component is destroyed.
getter/setter pair
enforceDestroyMethod bool
Whether destruction methods must be present.
getter/setter pair
enforceInitMethod bool
Whether initialization methods must be present.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
initMethods List<String>
Methods to be executed when the component is initialized.
getter/setter pair
isLazy bool?
Whether the component should be lazily initialized.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

equalizedProperties() List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
toStringOptions() → ToStringOptions

Operators

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