checkCRC16 static method

bool checkCRC16(
  1. Uint8List bytes
)

Implementation

static bool checkCRC16(Uint8List bytes) {
  try {
    int crc16 = CRCUtils.calculateCRC16(bytes.sublist(0, bytes.length - 2));
    return bytes[bytes.length - 2] == ((crc16 >> 8) & 0xFF) &&
        bytes[bytes.length - 1] == (crc16 & 0xFF);
  } catch (e) {
    return false;
  }
}