getSummonerInfo method

Future<Summoner> getSummonerInfo({
  1. String? summonerName,
})

Get an Future instance of the Summoner() class. So use the

.then(onValue){

}

method to get their name, account id, level and revision date.

Implementation

Future<Summoner> getSummonerInfo({String? summonerName}) async {
  var url =
      'https://$server.api.riotgames.com/lol/summoner/v4/summoners/by-name/$summonerName?api_key=$apiToken';
  var response = await http.get(
    Uri.parse(url),
  );
  //print(response.body);
  return Summoner.fromJson(
    json.decode(
      response.body,
    ),
  );
}