decodeJson static method

IpcMessage decodeJson(
  1. Object data
)

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

Implementation

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