flutter - Dart:如何根据标准获取列表的子集?
问题描述
食物是一个定义为:
class Food {
String name;
double price;
String image;
FoodTypes foodType;
Food({this.name, this.price, this.image, this.foodType});
}
以下代码将在一些转换后返回完整的食物列表(定义为食物列表):
foods.map((food) {
return FoodFrame(food);
}).toList(),
如何仅将操作应用于食物子集(例如 foodType == 'fruit')?
解决方案
推荐阅读
- python - 如何从向导 Odoo 11 编写另一个字段
- database - Laravel 和 Websockets 中的实时数据库
- angular - 在 Build 目录中找不到 Angular 6 延迟加载模块以及另外 2 个应用程序
- dynamics-crm - 在动态 crm 集线器中编辑“顶部栏”
- python - sympy 解决方法或乳胶解析器有问题吗?
- db2 - DB2 REORG 命令无法启动
- deep-learning - Runnig DeepPavlov 命名实体识别
- java - 为什么这会导致堆栈溢出错误?有向图
- xamarin - Xamarin Forms Google 登录问题
- graphql - Tableau 是否支持基于 GraphQL 的 API?