0Pricing
Dart Academy · Lesson

Transforming With map, where, and toList

Reshape lists with iterable methods.

Reshaping Lists

Instead of looping by hand, Dart lets you transform lists with tidy iterable methods. You describe the result and Dart builds it. ✨

map Transforms Items

The map method runs a function on every item and produces a new sequence of the results, leaving the original untouched.

var nums = [1, 2, 3];
var doubled = nums.map((n) => n * 2);

All lessons in this course

  1. Creating Lists and Indexing
  2. Adding, Removing, and Updating Items
  3. Searching and Sorting Lists
  4. Transforming With map, where, and toList
← Back to Dart Academy