当前位置:网站首页>Shutter - how to copy certain elements from a map to a new map in dart/shutter?
Shutter - how to copy certain elements from a map to a new map in dart/shutter?
2022-06-24 04:55:00 【nuts】
flutter - How to be in Dart/Flutter Remove some elements from a Map Copy to new Map in ?
How to be in Dart / Flutter Remove some elements from a Map Copy to new Map in ?
Old_Map = {
'A' : {Big : 'A', Small : 'a' },
'B' : {Big : 'B', Small : 'b' },
'C' : {Big : 'C', Small : 'c' },
'D' : {Big : 'D', Small : 'd' },
}
Old_Map => New_MapI just want to
'B' : {Big : 'B', Small : 'b' },
'C' : {Big : 'C', Small : 'c' },The best answer
You can do this
final oldMap = {
'A': {'Big': 'A', 'Small': 'a'},
'B': {'Big': 'B', 'Small': 'b'},
'C': {'Big': 'C', 'Small': 'c'},
'D': {'Big': 'D', 'Small': 'd'},
};
final newMap =
Map.fromIterable(oldMap.keys.where((k) => k == 'B' || k =='C'),
key: (k) => k, value: (v) => oldMap[v]); because keys return map Keyed Iterable<String>, So you can use where Method to check the required keys , Then it can be based on the old map Value filling value .
边栏推荐
- Are you ready for the exam preparation strategy of level II cost engineer in 2022?
- Verifying data models in golang
- event
- Getattribute return value is null
- 『渗透基础』Cobalt Strike基础使用入门_Cobalt Strike联动msfconsole
- 集成阿里云短信服务以及报签名不合法的原因
- Data acquisition gateway intelligent industrial Internet of things
- 线性回归的损失和优化,机器学习预测房价
- How to build a website for ECS is the price of ECS very expensive
- 事件
猜你喜欢

Analyzing the superiority of humanoid robot in the post human era

SAP MTS/ATO/MTO/ETO专题之七:ATO模式1 M+M模式策略用82(6892)

Final summary of freshman semester (supplement knowledge loopholes)

"Emergency response practice" logparser log analysis practice

SAP MTS/ATO/MTO/ETO专题之八:ATO模式2 D+空模式策略用85

线性回归的损失和优化,机器学习预测房价

Training methods after the reform of children's programming course

TCPIP协议详解

Idea创建Servlet 后访问报404问题

Popularization of children's programming education in specific scenarios
随机推荐
What are the functions and advantages of the Internet of things cloud platform?
How to restart the ECS? What are the differences between ECS restart and normal computers?
『应急响应实践』LogParser日志分析实践
Ext4 file system jam caused by MEM CGroup OOM
Find the current index of gbase 8C database?
5g and industrial Internet
Introduction à la méthode de descente par Gradient - document d'apprentissage automatique pour les programmeurs de chevaux noirs
Bi-sql where
How does ECS publish websites? What software tools are needed?
重新认识WorkPlus,不止IM即时通讯,是企业移动应用管理专家
mini-Web框架:装饰器方式的添加路由 | 黑马程序员
How does ECS select bandwidth? What types of servers do you usually have?
Deep learning common optimizer summary
Worthington弹性蛋白酶的应用和相关研究
What is Ping? How can the server disable Ping?
大一下学期期末总结(补充知识漏洞)
ribbon
How to open the port of ECS what are the precautions for using ECS
Jimureport building block report - expression introduction
梯度下降法介绍-黑马程序员机器学习讲义