RequiredIf<T> constructor

RequiredIf<T>(
  1. String? otherFieldName, {
  2. required dynamic equalTo,
  3. String? message,
})

Creates a new instance of the RequiredIf validation rule based on the equality of another field's value.

  • otherFieldName: The name of the other field to compare equality against (required).
  • equalTo: The value to compare for equality against the other field's value (required).
  • message: A custom validation message (optional) to be displayed when the validation fails.

Implementation

RequiredIf(this.otherFieldName, {required this.equalTo, String? message})
    : condition = null,
      super(message);