Dart 3 - Iterable.indexed

preview_player
Показать описание
Randal Schwartz shows off a new Dart 3 feature to add index numbers to an iterable with minimal fuss.

Рекомендации по теме
Комментарии
Автор

I’ve been waiting for this change. Thanks for sharing!

wembleyleach
Автор

Great tip ...so common to need an index with an item and this finally makes it simple ...enjoying all your videos, you've got a great way of breaking stuff down & explaining it

garyhunter
Автор

Would it be possible to destructure a record directly in a function declaration? So something like this:
final numberedWords = words (dot) indexed (dot) map( ( ??? ) => '#$index is $word');

ChristianZaefferer
Автор

Thanks for sharing this find! I certainly would not have found it until much later. Also with the "IterableExtensions" (where this ".indexed" lives) we get a few of the other handy features from the "collection" package - several of the "..OrNull" getters.

elijahluckey
Автор

I don't understand why collection is a package.

I thought that was to try new functions to include in the dart language later in a optimized way, but is not like the package has to many updates.

sambaotaku
Автор

Hi Randal, please give more zoom for your code, my eyes really hurts to see and understand your amazing tricks...

conceptcoder
Автор

Wow great tips! I learnt a lot from this. I never knew you could nest a for loop inside an array instantiation like in example 1.

flipside-games