Generic Collections- Set & Map
In this lesson, you will learn to use generics for two more Dart's collections: Set and Map.
We'll cover the following...
Let’s check out the type safe implementations for two of the Dart’s collection literals: Set & Map.
Set
In a Set collection, each object can only occur once.
Creating Set
A set theSet
of the String
data type is constructed using the parameterized constructor Set<String>.from({"1"})
.
Set<String> theSet = Set<String>.from({"1"});
Same data type item
Two more items of the same type String
are added to the set theSet
, iterating over the set theSet
...