createTextAtMessage static method

Future<V2TimValueCallback<V2TimMsgCreateInfoResult>> createTextAtMessage({
  1. required String text,
  2. required List<String> atUserList,
})

Implementation

static Future<V2TimValueCallback<V2TimMsgCreateInfoResult>> createTextAtMessage({
  required String text,
  required List<String> atUserList,
}) async {
  Map<String, dynamic> message = Tools.createNativeMessage(
    elem: List<Map<String, dynamic>>.from([
      Map<String, dynamic>.from({"elem_type": Tools.dartElemTypeToNative(MessageElemType.V2TIM_ELEM_TYPE_TEXT), "text_elem_content": text})
    ]),
  );
  String key = Tools.generateUniqueString();
  message["message_group_at_user_array"] = atUserList;

  createdMessage[key] = message;

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