Dart Programming - Map.remove() Function



Removes key and its associated value, if present, from the map. The function also returns the value associated with the key.

Syntax

 Map.remove(Object key) 

Parameters

  • Keys − identifies the entry to be deleted.

Return Type − Returns the value corresponding to the specified key.

Example

 void main() { Map m = {'name':'Tom','Id':'E1001'}; print('Map :${m}'); dynamic res = m.remove('name'); print('Value popped from the Map :${res}'); } 

It will produce the following output

 Map :{name: Tom, Id: E1001} Value popped from the Map :Tom 
dart_programming_map.htm
Advertisements