createTargetedGroupMessage static method

Future<V2TimValueCallback<V2TimMsgCreateInfoResult>> createTargetedGroupMessage({
  1. required String id,
  2. required List<String> receiverList,
})

Implementation

static Future<V2TimValueCallback<V2TimMsgCreateInfoResult>> createTargetedGroupMessage({
  required String id,
  required List<String> receiverList,
}) async {
  if (!createdMessage.containsKey(id)) {
    return V2TimValueCallback<V2TimMsgCreateInfoResult>.fromJson({
      "code": -1,
      "desc": "id not exist please try create again",
    });
  }
  Map<String, dynamic> message = createdMessage[id]!;
  createdMessage[id]!["message_target_group_member_array"] = receiverList;

  return V2TimValueCallback<V2TimMsgCreateInfoResult>.fromJson({
    "code": 0,
    "desc": "success",
    "data": Map<String, dynamic>.from({"id": id, "messageInfo": (await Tools.convertMessage2Dart(message)).toJson()})
  });
}