【发布时间】:2022-07-06 01:39:40
【问题描述】:
如何计算数组的标签? 我有这个代码:
class Product{
Product({required this.name, required this.tags});
final String name;
final List<String> tags;
}
void TagList(){
final product =[
Product(name: 'bmw', tags: ['car', 'm3']),
Product(name: 'kia', tags: ['car', 'morning', 'suv']),
Product(name: 'hyundai', tags: ['car', 'ev6', 'suv']),
];
}
如何获取每个标签的使用次数?
预期输出:
汽车(3) 立方米(1) EV6(1) 越野车(2) 早上(1)
【问题讨论】:
标签: dart collections