Created
March 25, 2020 21:10
-
-
Save tailorvj/494dd80d552f24ff8f0b3780849f75df to your computer and use it in GitHub Desktop.
Dart Set .contains() .forEach() and .clear() methods
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
| main() { | |
| Set<String> nameSet = {'Rita', 'Alex', 'Sam', 'Eva'}; | |
| print('nameSet.contains(\'Sam\'): ${nameSet.contains('Sam')}\n'); | |
| nameSet.forEach((element){ | |
| print('element: $element'); | |
| }); | |
| nameSet.clear(); | |
| print('\nnameSet.length after .clear(): ${nameSet.length}'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment