required static method

String? required(
  1. String? value, {
  2. String fieldName = "This area",
  3. String cantBeEmptyMessage = "can't be empty.",
})

Implementation

static String? required(
  String? value, {
  String fieldName = "This area",
  String cantBeEmptyMessage = "can't be empty.",
}) {
  if (value == null || value.trim().isEmpty) {
    return "$fieldName $cantBeEmptyMessage";
  }
  return null;
}