FetchUrl constructor

FetchUrl({
  1. required String url,
  2. required String saveToPath,
  3. Map<String, String>? headers,
  4. FetchMethod method = FetchMethod.get,
  5. OnFetchProgress progress = _devNull,
  6. FetchData? data,
})

ctor.

Implementation

FetchUrl(
    {required this.url,
    required this.saveToPath,
    Map<String, String>? headers,
    this.method = FetchMethod.get,
    this.progress = _devNull,
    this.data}) {
  this.headers = headers ?? <String, String>{};

  if (data != null && method != FetchMethod.post) {
    throw FetchException('FetchData is not supported for the FetchMethod:'
        '${EnumHelper().getName(method)}');
  }
}