From b4a358e1416a169613c44753aea9327dc10b3c51 Mon Sep 17 00:00:00 2001 From: Morenazzo Date: Tue, 30 Dec 2025 16:37:45 -0600 Subject: [PATCH 1/3] Add Dart Map .entries documentation --- .../concepts/map/terms/entries/entries.md | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 content/dart/concepts/map/terms/entries/entries.md diff --git a/content/dart/concepts/map/terms/entries/entries.md b/content/dart/concepts/map/terms/entries/entries.md new file mode 100644 index 00000000000..1344e7025c2 --- /dev/null +++ b/content/dart/concepts/map/terms/entries/entries.md @@ -0,0 +1,50 @@ +--- +Title: '.entries' +Description: 'Returns an iterable collection containing all key-value pairs as MapEntry objects in a map.' +Subjects: + - 'Computer Science' + - 'Code Foundations' +Tags: + - 'Dart' + - 'Data Structures' + - 'Properties' +CatalogContent: + - 'learn-dart' + - 'paths/computer-science' +--- + +In Dart, the **`.entries`** property returns an iterable collection containing all key-value pairs as `MapEntry` objects in a map. This allows you to iterate over both keys and values together. + +## Syntax + +```pseudo +myMap.entries +``` + +- `myMap`: The map name that needs to be iterated. + +## Example + +The following example demonstrates the usage of the `.entries` property: + +```dart +void main() { + Map scores = { + 'Alice': 95, + 'Bob': 87, + 'Charlie': 92 + }; + + for (var entry in scores.entries) { + print('${entry.key}: ${entry.value}'); + } +} +``` + +The above example produces the following output: + +```shell +Alice: 95 +Bob: 87 +Charlie: 92 +``` From e9b72dfcd973b2739044a3501c0595259bf33eb3 Mon Sep 17 00:00:00 2001 From: Mamta Wardhani Date: Thu, 1 Jan 2026 13:16:22 +0530 Subject: [PATCH 2/3] Revise .entries property documentation in Dart Updated the description and example for the .entries property in Dart to clarify its functionality and return value. --- .../dart/concepts/map/terms/entries/entries.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/content/dart/concepts/map/terms/entries/entries.md b/content/dart/concepts/map/terms/entries/entries.md index 1344e7025c2..112b256926a 100644 --- a/content/dart/concepts/map/terms/entries/entries.md +++ b/content/dart/concepts/map/terms/entries/entries.md @@ -1,6 +1,6 @@ --- Title: '.entries' -Description: 'Returns an iterable collection containing all key-value pairs as MapEntry objects in a map.' +Description: 'Returns an iterable view of all key-value pairs in a map as MapEntry objects.' Subjects: - 'Computer Science' - 'Code Foundations' @@ -13,7 +13,7 @@ CatalogContent: - 'paths/computer-science' --- -In Dart, the **`.entries`** property returns an iterable collection containing all key-value pairs as `MapEntry` objects in a map. This allows you to iterate over both keys and values together. +In Dart, the **`.entries`** property returns an iterable view of a `Map`’s contents, where each element is a `MapEntry` containing a key and its corresponding value. This property is useful when both keys and values need to be accessed together during iteration. ## Syntax @@ -21,11 +21,17 @@ In Dart, the **`.entries`** property returns an iterable collection containing a myMap.entries ``` -- `myMap`: The map name that needs to be iterated. +**Parameters:** -## Example +This property takes no parameters. -The following example demonstrates the usage of the `.entries` property: +**Return value:** + +Returns an `Iterable>`, where each `MapEntry` represents a key–value pair from the map. + +## Example 1: Iterating over keys and values together + +In this example, `.entries` is used to iterate through a map and access both the key and value for each entry: ```dart void main() { From ae281dc08a203cab4bc4cc0870940a70d522c76d Mon Sep 17 00:00:00 2001 From: Morenazzo Date: Mon, 5 Jan 2026 14:26:53 -0600 Subject: [PATCH 3/3] Add documentation for Dart Map .entries property - Add new term entry for .entries property - Include introduction, syntax, and example sections - Follows Codecademy Docs style guide - Closes #8112 --- content/dart/concepts/map/terms/entries/entries.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/dart/concepts/map/terms/entries/entries.md b/content/dart/concepts/map/terms/entries/entries.md index 112b256926a..929a3ad4bf5 100644 --- a/content/dart/concepts/map/terms/entries/entries.md +++ b/content/dart/concepts/map/terms/entries/entries.md @@ -17,7 +17,7 @@ In Dart, the **`.entries`** property returns an iterable view of a `Map`’s con ## Syntax -```pseudo +```dart myMap.entries ``` @@ -54,3 +54,5 @@ Alice: 95 Bob: 87 Charlie: 92 ``` + +This property is useful when both keys and values are needed during iteration.