What is the map.isNotEmpty method in Dart?
The map.isNotEmpty function in Dart is used to check if a map is empty or not.
map.isNotEmpty returns true if the map is not empty and contains key value pairs; otherwise, it returns false.
The illustration below shows the visual representation of the map.isNotEmpty function:
Syntax
void map_name.isNotEmpty
map_nameis the name of the queue.
Parameters
The map.isNotEmpty function does not require any parameters.
Return value
If the map is not empty, the map.isNotEmpty function returns true. Otherwise, it returns false.
Code
The following code shows how to use the map.isNotEmpty function in Dart:
import 'dart:convert';void main() {var map_1 = new Map();map_1 [1] = 'Tom';map_1 [2] = 'Alsvin';map_1 [3] = 'Eddie';//map containg key value pairsprint("map_1 is not empty: ${map_1.isNotEmpty}");//map emptyvar map_2 = new Map();print("map_2 is not empty: ${map_2.isNotEmpty}");}