required static method

String? required(
  1. String? value, {
  2. String fieldName = 'Este campo',
})

Validates that field is not empty fieldName is used in error message

Implementation

static String? required(String? value, {String fieldName = 'Este campo'}) {
  if (value == null || value.isEmpty) {
    return AppStrings.format(
      AppStrings.fieldRequired,
      [fieldName],
    );
  }
  return null;
}