Collections are data structures used to store and process a group of elements.

Dart does not support Arrays.

Dart collections provide multiple classes with generics.

Dart collections

Following are classes supported in dart collections.

  • List :

    • Stores the ordered collection of elements
    • Allow duplicate elemtns
    • Dynamic size
  • Set :

    • Stores the collection of elements in Unordered
    • Allow duplicate elemtns
    • Dynamic size
  • Map

    • Stores Collections of Key and Value pairs
    • Keys are unique.
    • Dynamic Collection of pairs
    • Keys and Values can contains null values
  • Queue

    • Stores elements in queue
    • Retrieval in First In First Out(FIFO)
|Collections | Description | Generics Classes| |:——–| ————— | |List| List is an order collection for storage that allows duplicates. Fixed and dynamic lists types| List<T>,| |Set| Set is similar to List except duplicates elements are allowed|Set<T>,HashSet<K, V>,LinkedHashSet<K, V>| |Maps| Stores key and value pairs similar to Hashtable and Dictionary in another programming language |Map<K, V>, MapBase<K, V>, HashMap<K, V>, LinkedHashMap<K, V>| |Queue| Separate collection type to update and add from both ends| Queue<T>,DoubleLinkedQueue<T>,LinkedList<T extends LinkedListEntry<T>>|