copyWith method

JSONRPCRequest copyWith({
  1. Object? id,
  2. String? method,
  3. Map<String, Object?>? params,
})

A copy with the given properties replaced; everything else, unknown keys included, is kept.

Implementation

JSONRPCRequest copyWith({
  Object? id,
  String? method,
  Map<String, Object?>? params,
}) =>
    JSONRPCRequest.fromJson({
      ...toJson(),
      if (id != null) 'id': $encode(id),
      if (method != null) 'method': $encode(method),
      if (params != null) 'params': $encode(params),
    });