facebook twitter hatena line google mixi email

Flutter/linq

提供: 初心者エンジニアの簡易メモ
移動: 案内検索

linqのサンプル

https://github.com/mythz/dart-linq-examples

検索

importは特にない。

class Product {
  int unitsInStock = 0;
 String productName = "hoge";
}
    List<Product> products = productsList();
    Iterable<Product> soldOutProducts = products
        .where((p) => p.unitsInStock == 0);
    print("Sold out products:");
    soldOutProducts.forEach((p) => print("${p.productName} is sold out!"));

  List<Product> productsList() {
    List<Product> products = new List<Product>();
    Product product = new Product();
    products.add(product);
    return products;
  }