clone abstract method

PodDefinition clone()
inherited

Creates and returns a deep clone of this pod definition.

A cloned pod definition is typically used when:

  • Reusing configuration across multiple pods
  • Creating prototype-scoped pods
  • Applying modifications without affecting the original definition

Subclasses must implement this method to ensure all fields are copied correctly.

Example

class RootPodDefinition extends PodDefinition {
  RootPodDefinition({required super.name, required super.type});

  @override
  PodDefinition clone() {
    return RootPodDefinition(name: name, type: type);
  }
}

final rootDef = RootPodDefinition(name: "root", type: Class<OtherService>());
final cloned = rootDef.clone();
print(cloned.name); // "root"

Implementation

PodDefinition clone();