Skip to content

Instantly share code, notes, and snippets.

@tailorvj
Created March 25, 2020 21:10
Show Gist options
  • Select an option

  • Save tailorvj/494dd80d552f24ff8f0b3780849f75df to your computer and use it in GitHub Desktop.

Select an option

Save tailorvj/494dd80d552f24ff8f0b3780849f75df to your computer and use it in GitHub Desktop.
Dart Set .contains() .forEach() and .clear() methods
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