createFaceMessage static method

Future<V2TimValueCallback<V2TimMsgCreateInfoResult>> createFaceMessage({
  1. required int index,
  2. required String data,
})

Implementation

static Future<V2TimValueCallback<V2TimMsgCreateInfoResult>> createFaceMessage({
  required int index,
  required String data,
}) 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_FACE),
        "face_elem_index": index,
        "face_elem_buf": data,
      })
    ]),
  );
  String key = Tools.generateUniqueString();
  createdMessage[key] = message;

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