Tutorial by Examples

Lists can be created in multiple ways. The recommended way is to use a List literal: var vegetables = ['broccoli', 'cabbage']; The List constructor can be used as well: var fruits = new List(); If you prefer stronger typing, you can also supply a type parameter in one of the following ways:...
Sets can be created via the constructor: var ingredients = new Set(); ingredients.addAll(['gold', 'titanium', 'xenon']);
Maps can be created in multiple ways. Using the constructor, you can create a new map as follow: var searchTerms = new Map(); Types for the key and value can also be defined using generics: var nobleGases = new Map<int, String>(); var nobleGases = <int, String>{}; Maps can othe...
All collection objects contain a map method that takes a Function as an argument, which must take a single argument. This returns an Iterable backed by the collection. When the Iterable is iterated, each step calls the function with a new element of the collection, and the result of the call becomes...
Dart allows to easily filter a list using where. var fruits = ['apples', 'oranges', 'bananas']; fruits.where((f) => f.startsWith('a')).toList(); //apples Of course you can use some AND or OR operators in your where clause.

Page 1 of 1