Curl constructor

Curl({
  1. required Uri uri,
  2. String method = 'GET',
  3. Map<String, String>? headers,
  4. String? data,
  5. String? cookie,
  6. String? user,
  7. String? referer,
  8. String? userAgent,
  9. List<FormDataModel>? formData,
  10. bool form = false,
  11. bool insecure = false,
  12. bool location = false,
})

Constructs a new Curl object with the specified parameters.

The uri parameter is required, while the remaining parameters are optional.

Implementation

Curl({
  required this.uri,
  this.method = 'GET',
  this.headers,
  this.data,
  this.cookie,
  this.user,
  this.referer,
  this.userAgent,
  this.formData,
  this.form = false,
  this.insecure = false,
  this.location = false,
}) {
  assert(
      ['GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'OPTIONS'].contains(method));
  assert(['http', 'https'].contains(uri.scheme));
  assert(form ? formData != null : formData == null);
}