RpcRequest class
- Inheritance
-
- Object
- RpcObject
- RpcObjectType
- RpcRequest
Constructors
- RpcRequest({required String method, dynamic id, dynamic params})
-
const
- RpcRequest.create(String method, [dynamic params])
- Creates a new RpcRequest with a random id
- RpcRequest.fromMeta(RpcMeta meta)
-
Creates a new RpcRequest from
meta
factory - RpcRequest.notify(String method, [dynamic params])
- Creates a new RpcRequest as a notification request
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- hasParams → bool
-
Returns
true
if this request has an paramsno setter - id → dynamic
-
finalinherited
- isIdInt → bool
-
Is the id of type int
no setter
- isIdString → bool
-
Is the id of type String
no setter
- isNotification → bool
-
Is this request a notification request
no setter
- isParamsList → bool
-
Returns true if params is a List
no setter
- isParamsMap → bool
-
Returns true if params is a Map
no setter
- method → String
-
final
- params → dynamic
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createResponse(
dynamic result, [RpcError? error]) → RpcResponse -
Returns a RpcResponse instance with
result
orerror
with the current request id -
encode(
{String postfix = '%SEP%'}) → List< int> -
Encodes RpcObject to bytes list
inherited
-
handle(
{RpcRequestHandler? onRequest, NotificationHandler? onNotification}) → Future< RpcResponse?> -
This function is used to detect if this request is a notification or not
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMeta(
) → RpcMeta -
Returns RpcMeta of the current RpcObjectType
override
-
toString(
) → String -
A string representation of this object.
override
-
waitForResponse<
T> () → Future< T> - A shortcut to wait for response
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator [](
dynamic key) → dynamic -
operator []=(
dynamic key, dynamic value) → void
Static Methods
-
generateId(
) → int -
Returns a new generated integer in range
0, 1 << 32