JsonRpcResponse<T> class
JSON RPC Response
- Inheritance
-
- Object
- Serialisable
- JsonRpcResponse
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
thisclass from the constructor parameters defined in thejsonobject.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
errorresponse.no setter - isSuccess → bool
-
If true, this instance represents a
successresponse.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
thisclass into a JSON object.override -
toJsonClean(
) → Map< String, dynamic> -
Returns the result of toJson, removing all
nullvalued 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
jsoncontains a result of type T. -
parse<
T, U> (Map< String, dynamic> json, JsonRpcParser<T, U> parse) → JsonRpcResponse<T> -
Creates an instance of
thisclass from the constructor parameters defined in thejsonobject. -
tryParse<
T, U> (Map< String, dynamic> ? json, JsonRpcParser<T, U> parse) → JsonRpcResponse<T> ? -
Creates an instance of
thisclass from the constructor parameters defined in thejsonobject.