ext function

Future<ExtResult> ext(
  1. ExtInput input
)

Discovers or invokes VM service extensions registered by the running app.

  • ExtListInput — calls getVM, unions extensionRPCs across all isolates, and returns a sorted, deduplicated list.
  • ExtCallInput — calls callServiceExtension on the first isolate that exposes the requested method, forwarding any --arg parameters.

Never throws; all error conditions are represented as sealed result cases.

Implementation

Future<ExtResult> ext(ExtInput input) async {
  try {
    return switch (input) {
      ExtListInput() => await _list(),
      ExtCallInput(:final method, :final args) => await _call(method, args),
    };
  } on AppDiedException catch (e) {
    return ExtAppDied(logLines: e.logLines, reason: e.reason);
  } catch (e) {
    return ExtError(e.toString());
  }
}