verifyNotEmpty function

bool verifyNotEmpty(
  1. List list, [
  2. String? message
])

Verify that a list is not empty.

Example:

verifyNotEmpty(results, 'Results should not be empty');

Returns true if the verification passed, false otherwise.

Implementation

bool verifyNotEmpty(List list, [String? message]) {
  if (list.isEmpty) {
    final msg = message ?? 'Expected non-empty list';
    _verificationFailures.add(msg);
    return false;
  }
  return true;
}