shouldRevalidate method

  1. @override
bool shouldRevalidate(
  1. FormKey source
)
override

Determines if this validator should be re-run when the specified form key changes.

This method is used for cross-field validation where one field's validity depends on another field's value. Return true if this validator should be re-executed when the specified form field changes.

Parameters:

  • source (FormKey): The form key that changed

Returns true if validation should be re-run, false otherwise.

Example:

@override
bool shouldRevalidate(FormKey source) {
  return source == passwordFieldKey; // Re-validate when password changes
}

Implementation

@override
bool shouldRevalidate(FormKey<dynamic> source) {
  return source == key;
}