checkBytes function

Uint8List checkBytes(
  1. Uint8List bytes,
  2. int length, {
  3. String name = "Bytes",
})

Throws an ArgumentError if the bytes are not of the required length and returns the bytes.

Implementation

Uint8List checkBytes(Uint8List bytes, int length, { String name = "Bytes" }) {
  if (bytes.length != length) {
    throw ArgumentError("$name should have length of $length", "bytes");
  }
  return bytes;
}