CsafeCommandResponse.fromBytes constructor

CsafeCommandResponse.fromBytes(
  1. Uint8List bytes
)

Implementation

CsafeCommandResponse.fromBytes(Uint8List bytes)
    : status = CsafeStatus.fromByte(bytes.elementAt(0)) {
  // these are all the bytes that werent already used
  Uint8List remainingBytes = bytes.sublist(1);

  while (remainingBytes.isNotEmpty) {
    CsafeDataStructure thisData =
        CsafeDataStructure.fromBytes(remainingBytes);
    data.add(thisData);

    remainingBytes = remainingBytes.sublist(thisData.byteLength);
  }
}