toSimple method

Future<String> Function(dynamic value) toSimple()

Converts the validator event to a FieldValidator instance.

Implementation

Future<String> Function(dynamic value) toSimple() {
  return (value) async {
    var res = await this(value);
    if (res.success) {
      return '';
    } else {
      return res.error.isNotEmpty ? res.error : res.errors.join(',');
    }
  };
}