Created
August 5, 2015 03:44
-
-
Save kasperpeulen/71c957a0d394f112bfd0 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; | |
| // 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