get method

Future<void> get(
  1. String url, {
  2. String? baseUrl,
  3. Map<String, dynamic>? params,
  4. Map<String, dynamic>? header,
  5. Success? success,
  6. SuccessList? successList,
  7. Empty? empty,
  8. Error? error,
  9. CancelToken? cancelToken,
  10. OnValueCallBack<CancelToken>? cancelTokenCallBack,
  11. bool isList = false,
})

get请求 baseUrl 切换baseUrl params 参数 success 请求对象成功回调 successList 请求列表成功回调 error 错误回调 isList 请求的数据是否为List列表 默认对象 isList=true 请求data数据为[]list列表

Implementation

Future<void> get(String url,
    {String? baseUrl,
    Map<String, dynamic>? params,
    Map<String, dynamic>? header,
    Success? success,
    SuccessList? successList,
    Empty? empty,
    Error? error,
    CancelToken? cancelToken, //可自定义一个取消令牌,也可从回调中获取系统默认取消令牌
    OnValueCallBack<CancelToken>? cancelTokenCallBack, //回调,返回一个取消令牌
    bool isList = false}) async {
  if (isList) {
    return await _requestList(Method.get, url,
        baseUrl: baseUrl,
        params: params,
        header: header,
        success: successList,
        empty: empty,
        cancelToken: cancelToken,
        cancelTokenCallBack: cancelTokenCallBack,
        error: error);
  } else {
    return await _request(Method.get, url,
        baseUrl: baseUrl,
        params: params,
        header: header,
        success: success,
        empty: empty,
        cancelToken: cancelToken,
        cancelTokenCallBack: cancelTokenCallBack,
        error: error);
  }
}