Skip to main content

New site for Dart news and articles

For the latest Dart news, visit our new blog at  https://medium.com/dartlang .

Breaking Change: Iterable.mappedBy is now Iterable.map, List.skip/take return Iterables

mappedBy(), we hardly knew ye!! Florian Loitsch tells us the reason for the name change to map() 

We are reverting the name-change to 'map'. I got a lot of feedback, and the name is clearly not working for most of you. We are therefore reverting back to "map".

In order to avoid mistakes we will also make the return-type (and dynamic type) of List.map be an Iterable, and not a List. This will, hopefully, make it more clear that the result is a lazy wrapper instead of an eager evaluation.

For consistency we changed the return-type of List.skip and List.take to be an Iterable too.

We are going to keep the mappedBy method in the implementation (next to "map") for several weeks, so you have the time to migrate. The List.skip/take methods will furthermore continue to return Lists (even though their return type is "Iterable").

When we finish the transition "mappedBy" will go away, and skip/take will return Iterables (dynamic type) and not Lists anymore.

A patch for this change has already been uploaded, and will be committed soon (probably tomorrow):
https://chromiumcodereview.appspot.com/12086062/.

Since we changed the name in the Iterable, we also changed it in the Stream class. So Stream.mappedBy is now Stream.map.

As always, we invite you to join our Dart mailing list, ask questions on Stack Overflow, or file feature requests on dartbug.com