getAvatar method

List<String?> getAvatar()

Implementation

List<String?> getAvatar() {
  var conversation = widget.conversation;

  if (conversation.type == ConversationType.V2TIM_C2C) {
    return [conversation.faceUrl];
  } else {
    if (TencentCloudChatUtils.checkString(conversation.faceUrl) != null) {
      return [conversation.faceUrl!];
    }
    if (TencentCloudChatUtils.checkString(conversation.groupID) == null) {
      return [""];
    }
    List<V2TimGroupMemberFullInfo?> groupMemberList =
        TencentCloudChat.instance.dataInstance.groupProfile.getGroupMemberList(conversation.groupID!);
    var list =
        groupMemberList.takeWhile((value) => TencentCloudChatUtils.checkString(value?.faceUrl) != null).toList();
    if (list.isNotEmpty) {
      if (list.length > 9) {
        list = list.sublist(0, 9);
      }
      return list.map((e) => e?.faceUrl!).toList();
    }
    return [""];
  }
}