Dart - Basics of Set Last Updated : 14 Jul, 2020 Comments Improve Suggest changes Like Article Like Report Set is a special type of collection in Dart programming. In which any object can occur only once. If we perform add operation in the set, if the object is already in the set then it will not add otherwise it will be added in the set. dart: core library provides the Set class for implementation. Syntax: Identifier = new Set() or Identifier = new Set.from(Iterable) Here, Iterable is the list of value which will be added in the set . Example 1: Dart void main() { // create a new set number Set number = new Set(); // add in the set number.add(1); number.add(2); number.add(5); number.add(1); // all elements are retrieved // in the order in which // they are inserted for(var no in number) { print(no); } } Output: 1 2 5 Example 2: Dart void main() { // Create a Set Number Which // contains a list of value Set number = new Set.from([1,11,14,11]); // all elements are retrieved // in the order in which // they are inserted for(var n in number) { print(n); } } Output: 1 11 14 Example 3: Dart void main() { // Create a Set Number Which // contains a list of value Set number = new Set.from(['geeks','for','geeks']); // all elements are retrieved // in the order in which // they are inserted for(var n in number) { print(n); } } Output: geeks for Comment More infoAdvertise with us Next Article Dart - Basics of Set A avengerjanus123 Follow Improve Article Tags : Dart Dart-Set Similar Reads Dart - Basic Syntax Dart is a static programming language developed by Google. According to the GitHub popularity index, it became the most popular programming language as it actually supports the flutter toolkit. Flutter is a framework that uses dartâs native compilation ability to generate fast cross-platform apps. D 5 min read Basics of Numbers in Dart Like other languages, Dart Programming also supports numerical values as Number objects. The number in Dart Programming is the data type that is used to hold the numeric value. Dart numbers can be classified as: int (Integer) The int data type is used to represent whole numbers.Declaring Integer in 6 min read Dart - Sets Sets in Dart is a special case in List, where all the inputs are unique i.e. it doesn't contain any repeated input. It can also be interpreted as an unordered array with unique inputs. The set comes into play when we want to store unique values in a single variable without considering the order of t 6 min read Dart - Classes And Objects Dart is an object-oriented programming language, so it supports the concept of class, object, etc. In Dart, we can define classes and objects of our own. We use the class keyword to do so. Dart supports object-oriented programming features like classes and interfaces.Let us learn about Dart Classes 4 min read Dart - Getters and Setters Getters and Setters, also called accessors and mutators, allow the program to initialize and retrieve the values of class fields respectively. Getters or accessors are defined using the get keyword.Setters or mutators are defined using the set keyword.A default getter/setter is associated with every 3 min read Like