parse<T, U> static method

JsonRpcContextResult<T> parse<T, U>(
  1. Map<String, dynamic> json,
  2. JsonRpcParser<T, U> parse
)

Creates an instance of this class from the constructor parameters defined in the json object.

JsonRpcContextResult.value is set to the return value of parse(json['value']).

JsonRpcContextResult.parse({ '<parameter>': <value> }, (U) => T);

Implementation

static JsonRpcContextResult<T> parse<T, U>(
  final Map<String, dynamic> json,
  final JsonRpcParser<T, U> parse,
) {
  const String valueKey = 'value';
  json[valueKey] = utils.tryParse(json[valueKey], parse);
  return JsonRpcContextResult<T>.fromJson(json);
}