copyWith method

MultipartRequest copyWith({
  1. HttpMethod? method,
  2. Uri? url,
  3. Map<String, String>? headers,
  4. Map<String, String>? fields,
  5. List<MultipartFile>? files,
  6. bool? followRedirects,
  7. int? maxRedirects,
  8. bool? persistentConnection,
})

Creates a new instance of MultipartRequest based of on this. It copies all the properties and overrides the ones sent via parameters.

Implementation

MultipartRequest copyWith({
  HttpMethod? method,
  Uri? url,
  Map<String, String>? headers,
  Map<String, String>? fields,
  List<MultipartFile>? files,
  bool? followRedirects,
  int? maxRedirects,
  bool? persistentConnection,
}) =>
    MultipartRequest(
      method?.asString ?? this.method,
      url ?? this.url,
    )
      ..headers.addAll(headers ?? this.headers)
      ..fields.addAll(fields ?? this.fields)
      ..files.addAll(files ?? this.files)
      ..followRedirects = followRedirects ?? this.followRedirects
      ..maxRedirects = maxRedirects ?? this.maxRedirects
      ..persistentConnection =
          persistentConnection ?? this.persistentConnection;