Client<R> class
abstract
JSON RPC Client
JSON RPC client interface.
- Implementers
Constructors
-
Client.new(Uri uri, {Duration? timeLimit, required JsonRpcClientEncoder encoder, required JsonRpcClientDecoder<
R> decoder}) -
Creates a JSON RPC client.
const
Properties
-
decoder
→ JsonRpcClientDecoder<
R> -
Converts the incoming responses of type
R
to JSON.final - encoder → JsonRpcClientEncoder
-
Converts the outgoing requests to byte data.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timeLimit → Duration?
-
The default timeout duration applied to each request.
final
- uri → Uri
-
The connecting endpoint.
final
Methods
-
dispose(
) → FutureOr< void> - Closes the client and disposes of all acquired resources.
-
handler<
T> (List< int> encoded, {JsonRpcClientConfig? config, int? id}) → Future<T> -
Sends an
encoded
JSON RPC request to uri and returns thedecoded
JSON response (Map or List of Maps). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onTimeout<
T> () → FutureOr< T> - Creates a TimeoutException.
-
send<
T> (JsonRpcRequest request, JsonRpcResponseDecoder< Map< decode, {JsonRpcClientConfig? config}) → Future<String, dynamic> , JsonRpcResponse<T> >JsonRpcSuccessResponse< T> > - Sends a JSON RPC request to uri and returns its response.
-
sendAll<
T> (List< JsonRpcRequest> request, JsonRpcResponseDecoder<List< decode, {JsonRpcClientConfig? config, bool eagerError = false}) → Future<Map< , List<String, dynamic> >JsonRpcResponse< >T> >List< JsonRpcResponse< >T> > - Sends a batch JSON RPC request to uri and returns its response.
-
timeout<
T> (Future< T> request, Duration? timeLimit) → Future<T> -
Creates a new Future that completes with the result of
request
or a TimeoutException iftimeLimit
elapses (default: Client.timeLimit). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited