Created
August 5, 2015 21:22
-
-
Save kasperpeulen/266bfaf35065248d8f20 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void main() { | |
| Map map = { | |
| 0: "not null", | |
| 1: null | |
| }; | |
| bool test(key) => map[key] == null; | |
| //test | |
| // This will remove all key/value pairs where the value is null. | |
| map.keys.where(test).toList().forEach(map.remove); | |
| // So the map should be of length 1 now. | |
| assert(map.length == 1); | |
| // prints {0: not null} | |
| print(map); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment