JsonRpcResponse<T> class

JSON RPC Response

Inheritance

Constructors

JsonRpcResponse({required String jsonrpc, T? result, JsonRpcException? error, int? id})
Defines a JSON-RPC response.
const
JsonRpcResponse.fromError(JsonRpcException error, {int? id})
Creates an JsonRpcResponse for the provided error.
factory
JsonRpcResponse.fromJson(Map<String, dynamic> json)
Creates an instance of this class from the constructor parameters defined in the json object.
factory
JsonRpcResponse.fromResult(T result, {int? id})
Creates an JsonRpcResponse for the provided result.
factory

Properties

error JsonRpcException?
The error response of a failed request.
final
hashCode int
The hash code for this object.
no setterinherited
id int?
The client-generated identifier sent with the request.
final
isError bool
If true, this instance represents an error response.
no setter
isSuccess bool
If true, this instance represents a success response.
no setter
jsonrpc String
The JSON-RPC version.
final
result → T?
The requested data or success confirmation (array|number|object|string|RpcException).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serialises this class into a JSON object.
override
toJsonClean() Map<String, dynamic>
Returns the result of toJson, removing all null valued entries.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

isType<T>(Map<String, dynamic> json) bool
Returns true if the response json contains a result of type T.
parse<T, U>(Map<String, dynamic> json, JsonRpcParser<T, U> parse) JsonRpcResponse<T>
Creates an instance of this class from the constructor parameters defined in the json object.
tryParse<T, U>(Map<String, dynamic>? json, JsonRpcParser<T, U> parse) JsonRpcResponse<T>?
Creates an instance of this class from the constructor parameters defined in the json object.

Constants

errorKey → const String
The response object's error key.
idKey → const String
The response object's id key.
jsonRpcKey → const String
The response object's jsonrpc key.
resultKey → const String
The response object's result key.