doubleListsEqual function
Checks if two lists of doubles are equal by comparing their lengths and values.
Returns true
if list1
and list2
are equal, or false
otherwise.
If the lengths of list1
and list2
are different, they are considered unequal.
For each value in list1
, if the corresponding value in list2
is different,
they are considered unequal.
Implementation
bool doubleListsEqual(List<double> list1, List<double> list2) {
if (list1.length != list2.length) return false;
return list1.length == list2.length &&
list1.asMap().entries.every((entry) {
int index = entry.key;
double value = entry.value;
return value == list2[index];
});
}