isDirty static method
Implementation
static bool isDirty(List<FormValue> values, List<FormValue> initialValues) {
int i = 0; // index to compare with initialValues
for (final value in values) {
if (value.isNotEmpty /* ignore empty values */) {
bool isDirty = //
i >= initialValues.length //
||
(i < initialValues.length //
&&
values[i] != initialValues[i]);
if (!value.isRequiredNotEmpty || !value.isValid) {
// if value's required fields are not empty or
// it is not valid then abort and mark form
// values as not dirty so that the form cannot
// be submitted.
return false;
}
if (isDirty) {
return true;
}
i++;
}
}
return i != initialValues.length;
}