validateNotEmpty function

void validateNotEmpty(
  1. List list, {
  2. String message = 'Input list cannot be empty.',
})

Utility functions for validating input data for encoders. Throws an ArgumentError if the list is empty.

Implementation

/// Throws an [ArgumentError] if the list is empty.
void validateNotEmpty(List<dynamic> list, {String message = 'Input list cannot be empty.'}) {
  if (list.isEmpty) {
    throw ArgumentError(message);
  }
}