length static method

void length(
  1. List<int> data,
  2. int expected, {
  3. required String operation,
  4. required String name,
})

Requires data to be exactly expected bytes, throws BuError otherwise.

Implementation

static void length(
  List<int> data,
  int expected, {
  required String operation,
  required String name,
}) {
  if (data.length != expected) {
    throw CoreErrors.invalidOperationArguments(
      operation,
      name: name,
      reason: 'expected $expected bytes, got ${data.length}',
      details: {'expected': '$expected', 'actual': '${data.length}'},
    );
  }
}