isFormValid method

bool isFormValid()

Check if the form is valid.

The isFormValid function is used to determine whether the entire form is valid based on its current state. It iterates through all form attributes, validates their values against their associated validation rules, and checks if there are any validation errors. If there are no validation errors, the function returns true, indicating that the form is valid. Otherwise, it returns false.

Returns: true if the form is valid with no validation errors; otherwise, false.

Implementation

bool isFormValid() {
  for (final attribute in _attributes.keys) {
    final value = getValue(attribute) ?? '';
    validateAttribute(attribute, value);
  }
  return getErrors().isEmpty;
}