sendGiftMessage method

dynamic sendGiftMessage(
  1. GiftItem item,
  2. BuildContext context
)

Implementation

sendGiftMessage(GiftItem item, BuildContext context) {
  final customInfo = {
    "version": 1.0, // 协议版本号
    "businessID": "flutter_live_kit", // 业务标识字段
    "data": {
      "cmd":
          "send_gift_message", // send_gift_message: 发送礼物消息, update_online_member: 更新在线人数
      "cmdInfo": {
        "type": item.type, // 1: 普通礼物, 2: 礼物不带特效, 3: 礼物带特效 [必填]
        "giftUrl": item.giftUrl, // 礼物图片地址 [必填]
        "giftCount": 1, // 礼物数量 [必填]
        "giftSEUrl": item.seUrl, // 礼物特效地址 [可选]
        "giftName": item.name,
        "giftUnits": TIM_t("朵"), // 礼物单位
      }, // 本次指令的额外信息
    }
  };
  messageController.sendGiftMessage(jsonEncode(customInfo), avChatRoomID);
  Navigator.pop(context);
}