evaluate abstract method

FutureOr<ObjectHolder<T>> evaluate(
  1. PodExpressionContext context
)

Evaluate the Pod Expression

Executes this expression within the given PodExpressionContext. The context provides:

  • The pod factory, used to construct or retrieve pod instances.
  • The scope, determining pod lifecycle and visibility.

The result is an ObjectHolder of type T, which safely wraps the resolved pod instance. ObjectHolder ensures type consistency and may include metadata such as caching or lifecycle status.

Return Value

A FutureOr of ObjectHolder<T>:

  • May return immediately if resolution is synchronous.
  • May return a Future if resolution requires async operations.

Example

final expr = SomeConcretePodExpression<int>();
final context = PodExpressionContext(factory, scope);

final holder = await expr.evaluate(context);
print(holder.getPod()); // e.g., 42

Error Handling

  • Throws if the pod cannot be resolved in the given context.
  • Subclasses should provide meaningful error messages when evaluation fails.

Implementation

FutureOr<ObjectHolder<T>> evaluate(PodExpressionContext context);