MessageHeader constructor

MessageHeader(
  1. Uint8List data
)

constructor from Uint8List(receive data).

Implementation

MessageHeader(Uint8List data) {
  String? header = parseHeaderSize(utf8.decode(data));

  if (header == null) {
    rawData = "";
    return;
  } else {
    rawData = header;
  }

  command = parseHeaderSection(header, Sections.command.name) ?? "";
  bodySize =
      int.parse(parseHeaderSection(header, Sections.bodySize.name) ?? "0");
}