从Map中删除键及其关联的值(如果存在),该函数还返回与键关联的值。
remove - 语法
Map.remove(Object key)
key - 标识要删除的条目。
返回类型 - 返回与指定键对应的值。
remove - 示例
void main() { Map m={'name':'Learnfk','Id':'E1001'}; print('Map :${m}'); dynamic res=m.remove('name'); print('Value popped from the Map :${res}'); }
它将产生以下输出-
Map :{name: Learnfk, Id: E1001} Value popped from the Map :Learnfk
参考链接
https://www.learnfk.com/dart-programming/dart-programming-map-function-remove.html