isEqualsMapDeep function
Returns true
if m1
and m2
are equals deeply (including values tree equality).
Implementation
bool isEqualsMapDeep(Map? m1, Map? m2, {ValueEquality? valueEquality}) {
if (identical(m1, m2)) return true;
if (m1 == null || m2 == null) return false;
if (m1.length != m2.length) return false;
var k1 = List.from(m1.keys);
var k2 = List.from(m2.keys);
k1.sort();
k2.sort();
if (!isEqualsListDeep(k1, k2, valueEquality: valueEquality)) return false;
for (var k in k1) {
var v1 = m1[k];
var v2 = m2[k];
if (!isEqualsDeep(v1, v2, valueEquality: valueEquality)) return false;
}
return true;
}