executeBundleAs<T> method

T executeBundleAs<T>(
  1. AstBundle bundle, {
  2. String? entryPoint,
  3. String name = 'main',
  4. List<Object?>? positionalArgs,
  5. Map<String, Object?>? namedArgs,
})

Execute bundle and unwrap the result to type T via D4.unwrapAs.

This is the typed entry point that consolidates the unwrap path — callers don't need to know about BridgedInstance, BridgedEnumValue, or InterpretedInstance; they get a plain T back (or a D4UnwrapException if the result can't be coerced).

For results that may be a Future (i.e. from async entry points), use executeBundleAsAsync instead.

Step 2 of tom_d4rt_flutterm/doc/d4rt_consolidation_plan.md.

Implementation

T executeBundleAs<T>(
  AstBundle bundle, {
  String? entryPoint,
  String name = 'main',
  List<Object?>? positionalArgs,
  Map<String, Object?>? namedArgs,
}) {
  final raw = executeBundle(
    bundle,
    entryPoint: entryPoint,
    name: name,
    positionalArgs: positionalArgs,
    namedArgs: namedArgs,
  );
  return D4.unwrapAs<T>(raw, visitor: _visitor);
}