I have a simple map:
Map<String, bool> selection = {};
Then the entries are added. At some point, I want to reset the selection, i.e.:
for (var name in selection.keys) {
selection[name] = false;
}
Is there a way to reset all values to false, using only one statement in Dart?
For example, the following statement is very convenient and concise to check if the selection is not empty:
if( selection.values.contains(true) )
So, I'm looking for something similar to reset all the values to false.
Rk: Out of scope answers ;-) :
- forEach
- writing a method/function to do the stuff
Addendum
Just found and tested this one:
selection.updateAll((name, value) => value = false);
But there could be something even more simple, i.e. without a lambda function.