addMemberApi method

dynamic addMemberApi({
  1. List? otherUserId,
  2. BuildContext? contexts,
})

Implementation

addMemberApi({List? otherUserId,BuildContext? contexts}) {
  var user = [];
  var  groupId =  widget.groupId;
  for(int i=0;i<widget.participentList!.length;i++){
    user.add(widget.participentList![i].userId);
  }


  var body = {
    "addMembersArr": otherUserId,
    "groupId": groupId,
    "secretKey": AppStorages.secKey,
    "members":user+otherUserId!,
    "viewBy":user+otherUserId,
  };
  print(body);

  socket.emit("add-member", body);
  socket.on("add-member-res", (data) {

    addMemberLoader.value = false;

    Navigator.pop(contexts!, "true");
  });
}