getStockList method
Implementation
@override
Future<List<StockModel>> getStockList(List<String> tickers) async {
final List<StockModel> stockList = [];
for (final ticker in tickers) {
final uri = Uri.parse(
'https://query1.finance.yahoo.com/v8/finance/chart/$ticker?range=1mo&interval=1d');
final response = await client.get(
uri,
headers: {'Content-Type': 'application/json'},
);
if (response.statusCode == 200) {
stockList.add(StockModel.fromYahooJson(json.decode(response.body)));
} else {
throw ServerException();
}
}
return stockList;
}