notEmptyList static method

void notEmptyList(
  1. List? list, [
  2. String? message
])

Asserts that the list is not empty

Implementation

static void notEmptyList(List? list, [String? message]) {
  if (list == null || list.isEmpty) {
    throw AssertionError(message ?? 'List must not be empty');
  }
}