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