The core factory interface for managing and retrieving pods (components) in Jetleaf.
A PodFactory is responsible for creating, managing, and providing access to application components (pods) throughout their lifecycle. It serves as the central container for dependency injection and component management in Jetleaf applications.
Usage Example:
class MyService {
void doWork() => print('Working...');
}
class MyController {
final MyService service;
MyController(this.service);
void execute() => service.doWork();
}
// Register pods and retrieve them
final factory = getPodFactory();
await factory.get<MyService>();
final controller = await factory.get<MyController>();
controller.execute();
See also:
- AutowirePodFactory for automatic dependency injection capabilities
- HierarchicalPodFactory for parent-child factory hierarchies
- ConfigurablePodFactory for configurable factory implementations
- Implemented types
- Implementers
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
containsPod(
String podName) → Future< bool> - Checks if a pod with the given name is registered in the factory.
-
containsType(
Class type, [bool allowPodProviderInit = false]) → Future< bool> - Checks if the factory contains a pod of the specified type.
-
get<
T> (Class< T> type, [List<ArgumentValue> ? args]) → Future<T> - Retrieves a pod instance by its type with optional arguments.
-
getAliases(
String podName) → List< String> - Retrieves all alias names for the specified pod.
-
getNamedObject(
String podName, [List< ArgumentValue> ? args]) → Future<Object> - Retrieves a pod as a generic Object by its name with optional arguments.
-
getObject(
Class< Object> type, [List<ArgumentValue> ? args]) → Future<Object> - Retrieves a pod as a generic Object by its type with optional arguments.
-
getPackageName(
) → String -
Represents an abstraction for identifying the package that an object,
resource, or service belongs to.
inherited
-
getPod<
T> (String podName, [List< ArgumentValue> ? args, Class<T> ? type]) → Future<T> - Retrieves a pod instance by its name with optional arguments.
-
getPodClass(
String podName) → Future< Class> - Retrieves the Class object for the specified pod name.
-
getProvider<
T> (Class< T> type, {String? podName, bool allowEagerInit = false}) → Future<ObjectProvider< T> > - Retrieves a provider for a pod, allowing for lazy or eager initialization.
-
isPrototype(
String podName) → Future< bool> - Checks if the specified pod is configured as a prototype.
-
isSingleton(
String podName) → Future< bool> - Checks if the specified pod is configured as a singleton.
-
isTypeMatch(
String name, Class typeToMatch, [bool allowPodProviderInit = false]) → Future< bool> - Checks if the pod with the specified name matches the given type.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resolveDependency(
DependencyDescriptor descriptor, [Set< String> ? autowiredPods]) → Future<Object?> - Resolves a dependency based on the provided descriptor.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited