Iterable.map(fn) runs fn on each element and yields a lazy Iterable of the results; .toList() materializes it back into a List. A clean transform is a pure function on one element at a time, so two map calls chain naturally: convert each value, then format each result. The original list is never modified.

Program

Play the program to convert Celsius temperatures to Fahrenheit and then to labels like 32F, then print them joined by spaces.

map_transform.dart
void main() {
  var celsius = [0, 10, 20];
  var fahrenheit = celsius.map((c) => c * 9 ~/ 5 + 32).toList();
  var labels = fahrenheit.map((f) => '${f}F').toList();
  print(labels.join(' '));
}
map `list.map(fn)` returns a lazy `Iterable` of `fn(e)` for each element. The element type can change, e.g. `int -> String`.
toList `.toList()` materializes a lazy `Iterable` into a fresh `List`, so downstream code can index, iterate again, or print a stable value.
chained transforms Two `map` calls chain cleanly: each pass is a single, pure value transform. The original `celsius` list is never modified.