validateListOfBytes static method

void validateListOfBytes(
  1. List<int> bytes, {
  2. String? onError,
})

Implementation

static void validateListOfBytes(List<int> bytes, {String? onError}) {
  for (int i = 0; i < bytes.length; i++) {
    final int byte = bytes[i];
    if (byte < 0 || byte > mask8) {
      throw ArgumentError("${onError ?? "Invalid bytes"} at index $i: $byte");
    }
  }
}