list method

  1. @override
Future<Result<Map<String, String>, String>> list()
override

list all coins supported by price service returns map where the key is the ticker and the value is the crypto's name

Implementation

@override
Future<Result<Map<String, String>, String>> list() async {
  final CoinGeckoResult<List<Coin>> result = await coingecko.listCoins();
  if (result.isError) {
    return Err(result.errorMessage);
  } else {
    Map<String, String> map = {for (var c in result.data) c.symbol: c.id};
    return Ok(map);
  }
}