validateNonEmpty static method

void validateNonEmpty(
  1. List data, {
  2. String? name,
})

Ensures the provided list is not empty.

Implementation

static void validateNonEmpty(List data, {String? name}) {
  if (data.isEmpty) {
    throw ArgumentError('${name ?? "Input data"} must not be empty.');
  }
}