validate method

Future<List<String>> validate(
  1. dynamic value
)

Validates the provided value against the field's constraints. Returns a list of validation error messages. @param value is the value to validate @returns a list of validation error messages, empty if valid

Implementation

Future<List<String>> validate(dynamic value) async {
  var results = <String>[];

  for (var validator in validators) {
    var result = await validator(value);
    if (result.isNotEmpty) {
      results.add(result);
    }
  }

  return results;
}