asyncValidator property

FormeAsyncValidator<String>? asyncValidator
finalinherited

used to perform an async validation

if you specify both asyncValidator and validator , asyncValidator will only worked after validator passed

isValid is used to check whether this validation is valid or not if you want to update ui before you return validation result , you should call isValid() first

eg:

asyncValidator:(controller,value,isValid) {
  return Future.delayed(const Duration(millseconds:500),(){
    if(isValid()) {
      updateUI();
    }
    return validationResult;
  });
}

if isValid() is false, it means widget is unmounted or another async validation is performed or reset is called

Implementation

final FormeAsyncValidator<T>? asyncValidator;