getAvatars method

Future<List<Avatar>> getAvatars(
  1. List<String> accountIds
)

returns the avatar of the given account ids

Implementation

Future<List<Avatar>> getAvatars(List<String> accountIds) async {
  List<Avatar> avatars = [];

  for (int i = 0; i < accountIds.length; i += 100) {
    List<String> ids = accountIds.sublist(
        i, i + 100 > accountIds.length ? accountIds.length : i + 100);

    var res = await send(
      method: "GET",
      url: "${Endpoints().accountAvatars}?accountIds=${ids.join(",")}",
    ) as List;

    for (var a in res) {
      avatars.add(Avatar(a["accountId"], a["avatarId"]));
    }
  }

  return avatars;
}