setIcon method

Future<void> setIcon(
  1. String filename
)

Update the icon of this.

await guild.setIcon('assets/images/my_guild_icon.png');

Implementation

Future<void> setIcon (String filename) async {
  String file = await Helper.getPicture(filename);

  Response response = await ioc.use<DiscordApiHttpService>().patch(url: "/guilds/$id")
    .payload({ 'icon': file })
    .build();

  if (response.statusCode == 200) {
    _icon = ImageFormater(file, '');
  }
}