executeBundleAsAsync<T> method
Async variant of executeBundleAs — awaits the result if it is a
Future before unwrapping to T.
Use this when the bundle's entry point is async (or otherwise
returns a Future). When the bundle is synchronous the awaited
value is the raw return — both paths converge on
D4.unwrapAs for the cast.
Implementation
Future<T> executeBundleAsAsync<T>(
AstBundle bundle, {
String? entryPoint,
String name = 'main',
List<Object?>? positionalArgs,
Map<String, Object?>? namedArgs,
}) async {
final raw = executeBundle(
bundle,
entryPoint: entryPoint,
name: name,
positionalArgs: positionalArgs,
namedArgs: namedArgs,
);
final resolved = raw is Future ? await raw : raw;
return D4.unwrapAs<T>(resolved, visitor: _visitor);
}