Generic Collections in Practice
Type List, Map, and custom containers.
Collections Are Generic
Dart's everyday collections are all generic. List, Set, and Map each take type parameters that lock in what they hold. 📦
Typing a List
A List takes one type parameter for its elements. Declaring List of String means every item must be a String.
List<String> names = ['Ada', 'Linus'];All lessons in this course
- Why Generics Beat dynamic
- Generic Classes and Methods
- Bounded Type Parameters With extends
- Generic Collections in Practice