Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 简化可迭代逻辑_Dart - Fatal编程技术网

Dart 简化可迭代逻辑

Dart 简化可迭代逻辑,dart,Dart,我有一个有效的代码。它在一个对象列表中循环,并获取对象的一个属性存在于另一个对象列表中的所有对象 List-watching=List(); for(watchedGames.list中的WatchedGame WatchedGame){ if(周游戏包含(watchedGame)) watching.add(watchedGame); }在结尾处插入呼叫: List<T> newList = list.where(condition).toList(); List newLis

我有一个有效的代码。它在一个对象列表中循环,并获取对象的一个属性存在于另一个对象列表中的所有对象

List-watching=List();
for(watchedGames.list中的WatchedGame WatchedGame){
if(周游戏包含(watchedGame))
watching.add(watchedGame);
}
在结尾处插入呼叫:

List<T> newList = list.where(condition).toList();
List newList=List.where(condition.toList();

我尝试了一下,现在我得到了“失败的断言:布尔表达式不能为空”。谢谢。我认为我的第二个问题是,我需要在条件函数中使用一个返回语句,接受这个答案。