notEmptyValidator function

String notEmptyValidator(
  1. String name,
  2. Map<String, String> values,
  3. String value
)

A validator which will complain if value is empty.

Implementation

String notEmptyValidator(String name, Map<String, String> values, String value) {
  if (value.isEmpty) {
    return 'You must provide a $name.';
  }
  return null;
}