JsonRpcClient class

A minimal JSON-RPC 2.0 client over a WebSocket.

Used by metro live:* to talk to the Dart Tooling Daemon and to the VM service of a running app without extra package dependencies.

Properties

done → Future<void>
Completes when the connection closes.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isClosed → bool
Whether the connection has closed.
no setter
notifications → Stream<JsonRpcNotification>
Notifications pushed by the peer.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timeout → Duration
The default time to wait for a response to a call.
final

Methods

call(String method, [Map<String, Object?> params = const {}, Duration? timeout]) → Future<Object?>
Calls method with params and returns the result of the response.
close() → Future<void>
Closes the connection and fails any calls still waiting.
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

connect(Uri uri, {Duration timeout = const Duration(seconds: 3)}) → Future<JsonRpcClient>
Opens a connection to the WebSocket at uri.