#dart:core example
Example illustrating how to remove key/value pairs from a Map
, where the key/value pair satisfies some test. Similar as the List.removeWhere
method.
Main library: dart:core
Main elements: Map Map.remove
Tags:
main() { | |
Map map = { | |
0: "not null", | |
1: null | |
}; | |
bool test(key) => map[key] == null; | |
map.keys.where(test).toList().forEach(map.remove); | |
print(map); | |
} |
name: dart.core_Map_Map.remove | |
description: > | |
Example illustrating how to remove key/value pairs from a `Map`, where the key/value pair satisfies some test. Similar as the `List.removeWhere` method. | |
homepage: https://gist.github.com/f290fa5bd08ab9304024 | |
environment: | |
sdk: '>=1.0.0<2.0.0' |