loadMore method

Future loadMore()

加载更多

Implementation

Future loadMore() async {
  onBegin?.call(true);
  await HttpRequest().get(
    requestUrl,
    params: commonParams,
    options: requestOptions,
    cancelToken: cancelToken,
    onSuccess: (data) {
      page++;
      final newList = jsonParse.call(data);
      listData.addAll(newList);
      easyRefreshController.finishLoad(
        newList.isEmpty ? IndicatorResult.noMore : IndicatorResult.success,
      );
      onSuccess?.call(data, true);
    },
    onFailed: (code, error) {
      easyRefreshController.finishLoad(IndicatorResult.fail);
      onFailed?.call(code, error, true);
    },
    onCommon: () {
      onCommon?.call(true);
    },
    bind: bind,
  );
}