The map.containsKey() function in Dart is used to check if a map contains the specific key sent as a parameter. map.containsKey() returns true if the map contains that key, otherwise it returns false.
Figure 1 below shows a visual representation of the map.containsKey() function:
map.containsKey(key)
mapis the name of the queue.
The map.containsKey() function requires a key in order to check that a specific key-value pair exists in the map.
The function returns a Boolean value, i.e., true if a specific key is present in a map or false if it is not present.
The following code shows how to use the map.containsKey() function in Dart:
import 'dart:convert';void main() {var map = new Map();map [1] = 'Tom';map [2] = 'Alsvin';map [3] = 'Eddie';//map containg 3 keyprint("map contains key number 3: ${map.containsKey(3)}");//map containg 0 keyprint("map contains key number 0: ${map.containsKey(0)}");}