File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
content/dart/concepts/map/terms/map Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change 11---
22Title : ' .map()'
3- Description : ' . map() transforms each key- value pair in a Dart Map into a new Map .'
3+ Description : ' Creates a new map by transforming each key– value pair of an existing map using a provided function .'
44Subjects :
55 - ' Computer Science'
66 - ' Web Development'
@@ -13,18 +13,28 @@ CatalogContent:
1313 - ' paths/computer-science'
1414---
1515
16- In Dart, the ` .map() ` method is used to create a new map by transforming each key- value pair of an existing map using a provided function.
16+ In Dart, the ** ` .map() ` ** method creates a new map by transforming each key– value pair of an existing map using a provided function.
1717
1818## Syntax
1919
2020``` pseudo
2121myMap.map((key, value) => MapEntry(newKey, newValue))
2222```
2323
24- - ` myMap ` : The map whose entries are to be transformed.
25- - ` key ` : The key from the original map.
26- - ` value ` : The value associated with the key.
27- - ` MapEntry ` : Represents a single key-value pair in the new map.
24+ Here, ` myMap ` is the map whose entries are to be transformed.
25+
26+ ** Parameters:**
27+
28+ - A function that takes two arguments:
29+ - ` key ` : The key from the original map.
30+ - ` value ` : The value associated with that key.
31+ - The function must return a ` MapEntry ` , which defines the key–value pair in the new map.
32+
33+ ** Return value:**
34+
35+ The ` .map() ` method returns a new ` Map ` containing the transformed key–value pairs.
36+
37+ > ** Note:** The original map remains unchanged.
2838
2939## Example 1
3040
You can’t perform that action at this time.
0 commit comments