validate method

  1. @override
bool validate()
override

Runs all validators against the current value synchronously and updates errors.

Cancels any in-flight or debounced async validation and resets isValidating to false. Returns true if all validators passed and errors is empty; false otherwise.

Implementation

@override
bool validate() {
  _debounceTimer?.cancel();
  _debounceTimer = null;
  ++_asyncValidationSeq;
  _isValidating.value = false;

  final errs = <String>[];
  for (final v in validators) {
    final err = v(value.value);
    if (err != null) errs.add(err);
  }
  errors.value = errs;
  return errs.isEmpty;
}