createImageMessage method

Future<V2TimValueCallback<V2TimMsgCreateInfoResult>> createImageMessage({
  1. required String imagePath,
  2. dynamic inputElement,
  3. String? imageName,
})

创建图片消息(图片文件最大支持 28 MB)

  • imagePath 图片路径(只有发送方可以获取到)
  • inputElement 用于选择图片的 DOM 节点(web端必填)

Implementation

Future<V2TimValueCallback<V2TimMsgCreateInfoResult>> createImageMessage({
  required String imagePath,
  dynamic inputElement,
  String? imageName,
}) async {
  if (await pathExits(imagePath)) {
    return ImFlutterPlatform.instance.createImageMessage(
      imagePath: imagePath,
      inputElement: inputElement,
      imageName: imageName,
    );
  }
  return V2TimValueCallback<V2TimMsgCreateInfoResult>.fromJson({
    "code": -5,
    "desc": "imagePath is not found",
    "data": V2TimMsgCreateInfoResult.fromJson(
      {
        "id": "",
        "messageInfo": V2TimMessage(
          elemType: 0,
        ),
      },
    ),
  });
}