getAvatars method Null safety

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(",")}",
    );

    (res as List)
        .map((e) => avatars.add(Avatar(e["accountId"], e["avatarId"])));
  }

  return avatars;
}