put method

Future put(
  1. String path, {
  2. dynamic data,
  3. Map<String, dynamic>? params,
  4. Options? options,
  5. CancelToken? cancelToken,
  6. bool refresh = false,
  7. bool noCache = !CACHE_ENABLE,
  8. String? cacheKey,
  9. bool cacheDisk = false,
  10. bool showToastOnError = true,
  11. bool showMask = false,
})

restful put 操作

Implementation

Future put(
  String path, {
  data,
  Map<String, dynamic>? params,
  Options? options,
  CancelToken? cancelToken,
  bool refresh = false,
  bool noCache = !CACHE_ENABLE,
  String? cacheKey,
  bool cacheDisk = false,
  bool showToastOnError = true,
  bool showMask = false,
}) async {
  Options requestOptions = options ?? Options();
  requestOptions = requestOptions.copyWith(extra: {
    "refresh": refresh,
    "noCache": noCache,
    "cacheKey": cacheKey,
    "cacheDisk": cacheDisk,
    toastOnError: showToastOnError,
    showMaskOnRequest: showMask,
  });

  Response response = await dio.put(
      path.startsWith('http') ? path : baseUrl + path,
      data: data,
      queryParameters: params,
      options: requestOptions,
      cancelToken: cancelToken ?? _cancelToken);
  return response.data;
}