decodeJson static method

CapabilityHandshake decodeJson(
  1. Object data
)

Decode UTF-8 JSON bytes (or a JSON string) into a handshake.

Implementation

static CapabilityHandshake decodeJson(Object data) {
  final text = data is String
      ? data
      : data is List<int>
          ? utf8.decode(data)
          : throw ArgumentError(
              'decodeJson expects String or List<int>, got ${data.runtimeType}');
  return fromWire(jsonDecode(text));
}