如何在<Object><Object>飞镖中将列表<列表>转换为列表


Future<List<Product>> getproduct() async {
final invoice = await isar.invoices.where().findAll();
var p = invoice.map((e) {
var a = e.products;
return a;
}).toList();
return p ;
}

返回Future<List<List< Product >>>,只希望Future<List< Product >>如何删除外部列表。

多亏了pskink,您可以像这样使用Iterable.expand

final invoice = await isar.invoices.where().findAll();
var p = invoice.map((e) => e.products).expand((element) => element).toList();

最新更新