Commit 194f0f22 authored by Jason Simmons's avatar Jason Simmons

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
parent 3154d55e
......@@ -175,7 +175,8 @@ class StockHomeState extends State<StockHome> {
int selectedTabIndex = 0;
Iterable<Stock> _getStockList(Iterable<String> symbols) {
return symbols.map((String symbol) => config.stocks[symbol]);
return symbols.map((String symbol) => config.stocks[symbol])
.where((Stock stock) => stock != null);
}
Iterable<Stock> _filterBySearchQuery(Iterable<Stock> stocks) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment