...

/

Generic Collections- List & Queue

Generic Collections- List & Queue

This lesson will cover using generics for two of the Dart's collections: List and Queue.

Let’s check out the type safe implementations for two of the Dart’s collection literals: List & Queue.

List

The List is an indexable collection of objects with a length.

In Dart, a List collection can store Generics are used to restrict the data type accepted by List.

In this example, we will create a List of type int. Afterward, we will observe the outcomes of adding the same data type to the list and examine when the different data type is added.

Creating a List

The List ...