oneOfLengths static method

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

Requires data length to be one of allowed, throws BuError otherwise.

Implementation

static void oneOfLengths(
  List<int> data,
  List<int> allowed, {
  required String operation,
  required String name,
}) {
  if (!allowed.contains(data.length)) {
    throw CoreErrors.invalidOperationArguments(
      operation,
      name: name,
      reason: 'length ${data.length} not in $allowed',
      details: {'actual': '${data.length}', 'allowed': '$allowed'},
    );
  }
}