requestHomeRecommendList static method

dynamic requestHomeRecommendList(
  1. int type,
  2. dynamic callBack(
    1. List<LiveRoomModel>?
    )
)

首页推荐列表接口 callBack 返回结果 type 1.光年推荐 2.游戏推荐

Implementation

static requestHomeRecommendList(int type, Function(List<LiveRoomModel>?) callBack) {
  DioManager().requestList<dynamic>(RequestType.POST, RequestApi.apiRec, params: {"type": type}, onSuccess: (data) {
    List<LiveRoomModel> itemList = [];
    for (var item in data) {
      itemList.add(LiveRoomModel.fromJson(item));
    }
    callBack(itemList);
  }, onError: (error) {
    callBack(null);
  }, errorToast: false);
}