requestImSendGift static method

dynamic requestImSendGift(
  1. int giftId,
  2. int giftNum,
  3. String liveId,
  4. bool isSerial,
  5. int serialNum,
  6. dynamic callBack(
    1. ErrorEntity
    ), {
  7. bool isBackpackGift = false,
})

直播间内送礼物 giftId 礼物id 必须 giftNum 礼物数量 必须 liveId 直播场次ID isSerial 是否连击(1是,0否,默认否) 非必须 serialNum 连击数,默认=1 callBack 返回结果

Implementation

static requestImSendGift(int giftId, int giftNum, String liveId, bool isSerial, int serialNum, Function(ErrorEntity) callBack,
    {bool isBackpackGift = false}) {
  if (isBackpackGift) {
    DioManager().request<dynamic>(RequestType.POST, RequestApi.apiImSendBackpackGift,
        params: {
          'propsId': giftId,
          'propNum': giftNum,
          'liveId': liveId,
          'isSerial': isSerial ? 1 : 0,
          'serialNum': isSerial ? serialNum : 1
        },
        errorToast: false, onSuccess: (data) {
      callBack(ErrorEntity(code: HttpCode.success, message: ""));
    }, onError: (error) {
      callBack(error);
    });
  } else {
    DioManager().request<dynamic>(RequestType.POST, RequestApi.apiImSendGift,
        params: {
          'giftId': giftId,
          'giftNum': giftNum,
          'liveId': liveId,
          'isSerial': isSerial ? 1 : 0,
          'serialNum': isSerial ? serialNum : 1
        },
        errorToast: false, onSuccess: (data) {
      callBack(ErrorEntity(code: HttpCode.success, message: ""));
    }, onError: (error) {
      callBack(error);
    });
  }
}