deserialize method

  1. @override
Message deserialize(
  1. Object message
)
override

Implementation

@override
Message deserialize(Object message) {
  Uint8List msgBytes = message is Uint8List ? message : throw Exception("Message is not a Uint8List");

  final decoded = const ncbor.CborDecoder().convert(msgBytes).toJson(substituteValue: msgBytes);
  if (decoded is! List) {
    throw Exception("bad type");
  }

  return toMessage(decoded);
}