Skip to content

Map constructors taking Iterables #11330

Closed
@floitschG

Description

@floitschG

Add:

Map<K, V>.fromIterable(Iterable iterable, { K key(element), V value(element) });
key and value default to the identity function.  (Still a small discussion going for the name of the optional arguments).

and
Map<K, V>.fromIterables(Iterable<K> keys, Iterable<V> values);

Examples:
new Map<int, String>.fromIterable([1, 2], value: (x) => "$x");
new Map<int, String>.fromIterables([1, 2], ["eins", "zwei"]);

Metadata

Metadata

Assignees

Labels

area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.type-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions