required static method

String? required(
  1. String? value, [
  2. String fieldName = 'This field'
])

Implementation

static String? required(String? value, [String fieldName = 'This field']) {
  if (value == null || value.trim().isEmpty) return '$fieldName is required.';
  return null;
}