VmServiceClient class

Typed VM-service client used by LeonardSession.

Two construction modes:

  • fromVmService wraps an already-connected VmService supplied by the caller (e.g. the DevTools extension's serviceManager.service) as a borrowed connection.
  • fromOwnedVmService resolves the first isolate for a connection opened by the I/O-only entrypoint and marks it as owned.

Platform imports are confined by tool/check_no_dart_io.sh. Tests inject a fake via VmServiceClient.forTest.

Constructors

VmServiceClient.forTest(VmService vm, String isolateId, {bool ownsConnection = false})
Test-only alias for fromVmService. Retained so existing tests compile unchanged; new code should use fromVmService. Pass ownsConnection: true to exercise owning disposal.
factory
VmServiceClient.fromVmService(VmService vm, String isolateId)
Wrap an already-connected VmService and pin isolateId as the binding's home isolate.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
isolateId String
Isolate pinned for every service-extension call.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

callExtension(String extension, Map<String, dynamic> args) Future<Map<String, dynamic>>
Generic escape hatch for extension-provided extensions (used to pull extension contributions). The extension string is passed through verbatim.
dispose() Future<void>
Dispose the VM-service connection — but ONLY if the I/O entrypoint created it. A client built from a BORROWED connection (fromVmService, e.g. DevTools' shared serviceManager.service) must not tear down a connection it does not own, so dispose is a no-op there. This is what stops a DevTools session teardown from killing the panel's live link to the app.
executeAction(String name, Map<String, dynamic> args) Future<Map<String, dynamic>>
Invoke the per-tool VM service extension that the binding registers via ExtensionContext.registerExtension: ext.leonard.<namespace>.<tool>.
handshake() Future<HandshakeResult>
Exchange the ext.leonard.core.handshake contract version and active extension manifest.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

connectForTest(VmService vm) Future<VmServiceClient>
Exercise the owning connect path with an already-open vm.