fromString static method

JsonRpcMethod fromString(
  1. String? method
)

Implementation

static JsonRpcMethod fromString(String? method) {
  if (method == null) {
    throw Exception('Method cannot be null');
  }

  return JsonRpcMethod.values.firstWhere(
    (e) => e.value.toLowerCase() == method.toLowerCase(),
    orElse: () => throw Exception('Unknown JSON-RPC method: $method'),
  );
}