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