Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created January 13, 2020 18:00
Show Gist options
  • Select an option

  • Save azamsharp/24270e681a69d950ccbbd867c0fd5b08 to your computer and use it in GitHub Desktop.

Select an option

Save azamsharp/24270e681a69d950ccbbd867c0fd5b08 to your computer and use it in GitHub Desktop.
Future<void> load() async {
final list = await Future.wait([Webservice().getStocks(), Webservice().getTopNews()]);
stocks = list.first.map((stock) => StockViewModel(stock: stock)).toList(); // stocks
newsArticles = list.last.map((newsArticle) => NewsArticleViewModel(newsArticle: newsArticle)).toList(); // news articles
notifyListeners();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment