AbstractPodDefinition constructor

AbstractPodDefinition({
  1. required Class type,
  2. Object? instance,
  3. String? resolvedDestroyMethodName,
})

Creates an AbstractPodDefinition with a given name and type.

  • name: The name of the pod.
  • type: The type of the pod.

An abstract base class for pod definitions that extends PodDefinition.

AbstractPodDefinition adds mutable state and utility methods to support advanced features such as:

  • Tracking whether a pod definition is stale
  • Marking whether a pod is a provider (factory) of other pods
  • Attaching a PodExpression to represent its creation logic
  • Checking whether lifecycle methods like destroy exist

Typically, concrete pod definitions (e.g., RootPodDefinition) extend this class to customize behavior while leveraging the shared mutability features.

Example

class RootPodDefinition extends AbstractPodDefinition {
  RootPodDefinition() : super(name: "root", type: Class<OtherService>());
}

final rootDef = RootPodDefinition();
rootDef.setIsStale(true);

if (rootDef.getIsStale()) {
  print("Pod definition needs re-evaluation");
}

rootDef.setIsPodProvider(true);
print(rootDef.getIsPodProvider()); // true

Implementation

AbstractPodDefinition({required super.type, this.instance, this.resolvedDestroyMethodName});