notEmpty static method

void notEmpty(
  1. List? list,
  2. String message
)

Asserts that the given list is not null and not empty.

Throws an InvalidArgumentException with the given message if the list is null or empty.

Example:

Assert.notEmpty(items, 'Items list must not be empty');

Implementation

static void notEmpty(List? list, String message) {
  if (list == null || list.isEmpty) {
    throw InvalidArgumentException(message);
  }
}