handler<T> method

  1. @override
Future<T> handler<T>(
  1. List<int> encoded, {
  2. JsonRpcClientConfig? config,
  3. int? id,
})
override

Sends an encoded JSON RPC request to uri and returns the decoded JSON response (Map or List of Maps).

The config object can be used to configure the request.

Implementation

@override
Future<T> handler<T>(
  final List<int> encoded, {
  final JsonRpcClientConfig? config,
  final int? id,
}) async {
  final Future<http.Response> request = _client.post(
    uri,
    body: encoded,
    headers: _headers(config?.headers),
  );
  final http.Response response = await timeout(
    request,
    config?.timeLimit,
  );
  return decoder.convert(response.bodyBytes) as T;
}