MultipartFormDataUpload constructor

MultipartFormDataUpload({
  1. required String url,
  2. UploadMethod method = UploadMethod.POST,
  3. Map<String, String>? headers,
  4. String? tag,
  5. List<FileItem>? files,
  6. Map<String, String>? data,
  7. bool allowCellular = true,
})

Default constructor which requires either files or data to be set.

Implementation

MultipartFormDataUpload({
  required String url,
  UploadMethod method = UploadMethod.POST,
  Map<String, String>? headers,
  String? tag,
  this.files,
  this.data,
  bool allowCellular = true,
})  : assert(files != null || data != null),
      super(
        url: url,
        method: method,
        headers: headers,
        tag: tag,
        allowCellular: allowCellular,
      ) {
  // Need to specify either files or data.
  assert(files!.isNotEmpty || data!.isNotEmpty);
}