fieldValidator method

String? fieldValidator(
  1. String? value
)

Implementation

String? fieldValidator(String? value) {
  value ??= "";

  List<String> errors = [];

  for (var v in validations) {
    if (v.validate(value: value, field: this)) {
      errors.add(v.errorMessage);
    }
  }

  return errors.isEmpty
      ? null
      : errors.length == 1
          ? errors.first
          : errors.map((e) => "- $e").join("\n");
}