Dart Iterable map():-

Dart Iterable map():-

·

1 min read

map():

  • The current elements of this iterable modified by toElement.

  • Returns a new lazy Iterable with elements that are created by calling toElement on each element of this Iterable in iteration order.

void main() {
  List<int> list = [1, 2, 3, 4, 5];
  var doublenum = list.map((e) => e * 2);
  print(doublenum);

  var edoublenum = list.map((e) => e * e);

  print(edoublenum);
}
(2, 4, 6, 8, 10)
(1, 4, 9, 16, 25)

Exited.