From c8283240062c4d3dd694e427ab27a05a5f5c5593 Mon Sep 17 00:00:00 2001 From: omkar hole Date: Wed, 24 Dec 2025 22:03:08 +0530 Subject: [PATCH 1/3] Add .isEmpty term entry for Dart Map Adds documentation for the Dart Map `.isEmpty` property, including a brief introduction, syntax, and a usage example aligned with Docs guidelines. --- .../concepts/map/terms/is-empty/is-empty.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 content/dart/concepts/map/terms/is-empty/is-empty.md diff --git a/content/dart/concepts/map/terms/is-empty/is-empty.md b/content/dart/concepts/map/terms/is-empty/is-empty.md new file mode 100644 index 00000000000..a0846aaf949 --- /dev/null +++ b/content/dart/concepts/map/terms/is-empty/is-empty.md @@ -0,0 +1,69 @@ +--- +Title: '.isEmpty' +Description: 'Checks if a Map contains no key-value pairs.' +Subjects: + - 'Computer Science' + - 'Code Foundations' +Tags: + - 'Dart' + - 'Map' + - 'Properties' +CatalogContent: + - 'learn-dart' + - 'paths/computer-science' +--- + +In Dart, the **`.isEmpty`** property is used to check if a `Map` contains no key-value pairs. If the map is empty, the property returns `true`. Otherwise, it returns `false`. + +## Syntax + +```pseudo +mapName.isEmpty +``` + +- `mapName`: The `Map` to be checked. + +## Example + +The following example demonstrates the usage of the `.isEmpty` property: + +```dart +void main() { + // Creating an empty Map + Map emptyCart = {}; + + // Creating a Map with items + Map fruitCart = {'Apple': 3, 'Banana': 5}; + + // Checking if the maps are empty + print(emptyCart.isEmpty); + print(fruitCart.isEmpty); +} +``` + +The above code produces the following output: + +```shell +true +false +``` + +The `.isEmpty` property can also be used in conditional statements: + +```dart +void main() { + Map userInfo = {}; + + if (userInfo.isEmpty) { + print('No user data available.'); + } else { + print('User data found.'); + } +} +``` + +The above code produces the following output: + +```shell +No user data available. +``` From 16e44ec009e83760d80bfb81a5d196baba93b2a6 Mon Sep 17 00:00:00 2001 From: omkar hole Date: Wed, 24 Dec 2025 22:18:07 +0530 Subject: [PATCH 2/3] Refine Dart Map .isEmpty documentation Updates the `.isEmpty` term entry by improving wording and syntax examples to better align with Docs style guidelines. --- content/dart/concepts/map/terms/is-empty/is-empty.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/dart/concepts/map/terms/is-empty/is-empty.md b/content/dart/concepts/map/terms/is-empty/is-empty.md index a0846aaf949..273b2d39f0f 100644 --- a/content/dart/concepts/map/terms/is-empty/is-empty.md +++ b/content/dart/concepts/map/terms/is-empty/is-empty.md @@ -18,7 +18,7 @@ In Dart, the **`.isEmpty`** property is used to check if a `Map` contains no key ## Syntax ```pseudo -mapName.isEmpty +map.isEmpty ``` - `mapName`: The `Map` to be checked. @@ -41,7 +41,7 @@ void main() { } ``` -The above code produces the following output: +The above example produces the following output: ```shell true @@ -62,7 +62,7 @@ void main() { } ``` -The above code produces the following output: +The above example produces the following output: ```shell No user data available. From 96fea9a250549ab0fb2f90b140d5046a9826f1ed Mon Sep 17 00:00:00 2001 From: Omkar Hole <182200831+omkarhole@users.noreply.github.com> Date: Wed, 24 Dec 2025 22:21:11 +0530 Subject: [PATCH 3/3] Clarify parameter name in isEmpty documentation Updated parameter description for isEmpty method. --- content/dart/concepts/map/terms/is-empty/is-empty.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/dart/concepts/map/terms/is-empty/is-empty.md b/content/dart/concepts/map/terms/is-empty/is-empty.md index 273b2d39f0f..22dfeb6325d 100644 --- a/content/dart/concepts/map/terms/is-empty/is-empty.md +++ b/content/dart/concepts/map/terms/is-empty/is-empty.md @@ -21,7 +21,8 @@ In Dart, the **`.isEmpty`** property is used to check if a `Map` contains no key map.isEmpty ``` -- `mapName`: The `Map` to be checked. +- `map`: The `Map` is object. +- ## Example