From 194f0f22e3c6b7a143ea5d883b50ece97c84f575 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 26 Oct 2015 11:12:08 -0700 Subject: [PATCH] In the stock list, filter out any symbols that have not yet been fetched If you load the example and immediately switch to the Portfolio tab, you may see exceptions due to symbols that are in the portfolio list but whose data is not yet present in the stocks map --- examples/stocks/lib/stock_home.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/stocks/lib/stock_home.dart b/examples/stocks/lib/stock_home.dart index 42d5db4776..7fd65b2de0 100644 --- a/examples/stocks/lib/stock_home.dart +++ b/examples/stocks/lib/stock_home.dart @@ -175,7 +175,8 @@ class StockHomeState extends State { int selectedTabIndex = 0; Iterable _getStockList(Iterable symbols) { - return symbols.map((String symbol) => config.stocks[symbol]); + return symbols.map((String symbol) => config.stocks[symbol]) + .where((Stock stock) => stock != null); } Iterable _filterBySearchQuery(Iterable stocks) {