For example, I have the following two dynamic maps that have the same keys and values:
Map a = {
'name':'alex',
'products': {'type':'cars'},
'rate':100,
'others':['not yet']
};
Map b = {
'name':'alex',
'products': {'type':'cars'},
'rate':100,
'others':['not yet']
};
when i call
print((a==b).toString()); => always print false why ?
How to check it in the correct way I need to know if these two maps have the same keys and values exactly.
2
Answers
You can try DeepCollectionEquality class in here
example:
You might need to do the following things(in the given order) in order to check whether two(or more) maps are equal or not
Alternatively you can use the package https://api.flutter.dev/flutter/foundation/mapEquals.html.
But the only drawback is that its takes only two maps as input