checkBytes function
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;
}