putFile method

Future<StreamedResponse> putFile(
  1. File file,
  2. FileStat fileStat,
  3. PathUri path, {
  4. DateTime? lastModified,
  5. DateTime? created,
  6. String? checksum,
  7. void onProgress(
    1. double progress
    )?,
})

Puts a new file at path with file as content.

lastModified sets the date when the file was last modified on the server. created sets the date when the file was created on the server. checksum has to follow checksumPattern. It will not be validated by the server. onProgress can be used to watch the upload progress. Possible values range from 0.0 to 1.0.

See:

Implementation

Future<http.StreamedResponse> putFile(
  File file,
  FileStat fileStat,
  PathUri path, {
  DateTime? lastModified,
  DateTime? created,
  String? checksum,
  void Function(double progress)? onProgress,
}) async {
  final request = putFile_Request(
    file,
    fileStat,
    path,
    lastModified: lastModified,
    created: created,
    checksum: checksum,
    onProgress: onProgress,
  );

  final streamedResponse = await httpClient.send(request);
  if (streamedResponse.statusCode != 201) {
    final response = await http.Response.fromStream(streamedResponse);
    throw DynamiteStatusCodeException(response);
  }

  return streamedResponse;
}