decode static method

Datagram? decode(
  1. Unpacker u
)

Implementation

static Datagram? decode(Unpacker u) {
  switch (u.unpackListLength()) {
    case 0: return null;
    case 2: break;
    default: throw DecodeError();
  }
  return Datagram(
    data: u.unpackBinary(),
    addr: (u.unpackString())!,
  );
}