get method
Future<void>
get(
- String url, {
- String? baseUrl,
- Map<
String, dynamic> ? params, - Map<
String, dynamic> ? header, - SuccessDy? success,
- SuccessListDy? successList,
- Cache? cache,
- CacheList? cacheList,
- bool isCache = false,
- DioCacheConfig? dioCacheConfig,
- Empty? empty,
- Error? error,
- @Deprecated('不需要设置了,使用具体返回类型判断') bool isList = false,
get请求
url 请求地址
baseUrl 域名
params 参数
header header
success 成功回调
successList 成功回调
cache 缓存回调
cacheList 缓存回调
isCache 是否开启缓存 开启缓存 默认缓存7天 适合长时间不经常更新接口
dioCacheConfig 缓存配置 与isCache互斥 适合个性化配置接口 配置信息参考DioCacheConfig类。
empty 空数据回调,只适合返回data为对象时有效。
error 错误回调
Implementation
Future<void> get(String url,
{String? baseUrl,
Map<String, dynamic>? params,
Map<String, dynamic>? header,
SuccessDy? success,
SuccessListDy? successList,
Cache? cache,
CacheList? cacheList,
bool isCache = false,
DioCacheConfig? dioCacheConfig,
Empty? empty,
Error? error,
@Deprecated('不需要设置了,使用具体返回类型判断') bool isList = false}) async {
if ((successList != null || cacheList != null)) {
return await _requestList(Method.get, url,
baseUrl: baseUrl,
params: params,
header: header,
successList: successList,
isCache: isCache,
cacheList: cacheList,
dioCacheConfig: dioCacheConfig,
empty: empty,
error: error);
} else {
return await _request(Method.get, url,
baseUrl: baseUrl,
params: params,
header: header,
isCache: isCache,
cache: cache,
dioCacheConfig: dioCacheConfig,
success: success,
empty: empty,
error: error);
}
}