getChampionMasteries method
Get an Future instance of the ChampionMasteries class. So use the
.then(onValue){
}
method to get their champion name, level and if chest aquired.
Implementation
Future<List<ChampionMastery>?> getChampionMasteries({String? summonerID}) async {
var url =
'https://$server.api.riotgames.com/lol/champion-mastery/v4/champion-masteries/by-summoner/$summonerID?api_key=$apiToken';
var response = await http.get(
Uri.parse(url),
);
var championMasteries = json.decode(
response.body,
);
champMasteriesList = [];
championMasteries.forEach(
(championMastery) {
champMasteriesList!.add(
ChampionMastery.fromJson(
json.decode(json.encode(championMastery)),
),
);
},
);
return champMasteriesList;
}