check method
Validates the field asynchronously and updates the exception state.
It first performs synchronous validation using super.check. If that passes,
it proceeds to asynchronous validation by calling AsyncField.asyncValidator.
Returns a Future that completes with true if the field is valid after validation,
or false if it is invalid.
Example
final isValid = await field.check();
if (isValid) {
// Proceed with valid data
} else {
// Handle validation errors
}
Implementation
@mustCallSuper
Future<bool> check() async {
switch (validator(value)) {
case null:
_exception = null;
case FFormException exception:
if (exception.isValid) {
_exception = null;
} else if (exception case E? e) {
_exception = e;
}
case E exception:
_exception = exception;
}
notifyListeners();
return isValid;
}