areBytesValid static method

bool areBytesValid(
  1. Iterable<int> bytes, {
  2. Object onValidationFailed()?,
})

Implementation

static bool areBytesValid(
  Iterable<int> bytes, {
  Object Function()? onValidationFailed,
}) {
  for (int i = 0; i < bytes.length; i++) {
    final int byte = bytes.elementAt(i);
    if (byte < 0 || byte > BinaryOps.mask8) {
      if (onValidationFailed != null) throw onValidationFailed();
      return false;
    }
  }
  return true;
}