isRequired method

bool isRequired(
  1. Map<String, FormFieldState> fields
)

Expose whether the field should be required given the current form state.

Implementation

bool isRequired(Map<String, FormFieldState> fields) {
  if (condition != null) return condition!();
  if (otherFieldName != null) {
    return fields[otherFieldName!]?.value == equalTo;
  }
  return false;
}