compare static method
Validator
compare(
- String controlName,
- String compareControlName,
- CompareOption compareOption, {
- bool allowNull = false,
Creates a FormGroup validator that compares two controls in the group.
The arguments controlName, compareControlName and compareOption
must not be null.
allowNull (optional): skip this validation if one of the controls has
null value. Defaults to false (report an error in case of null).
Example:
Validates that 'amount' is lower or equals than 'balance'
final form = fb.group({
'amount': 20.00,
'balance': 50.00,
}, [Validators.compare('amount', 'balance', CompareOption.lowerOrEquals)]);
Implementation
static Validator<dynamic> compare(
String controlName,
String compareControlName,
CompareOption compareOption, {
bool allowNull = false,
}) {
return CompareValidator(
controlName,
compareControlName,
compareOption,
allowNull: allowNull,
);
}