put method

Future<StreamedResponse> put(
  1. Uint8List localData,
  2. PathUri path, {
  3. DateTime? lastModified,
  4. DateTime? created,
  5. String? checksum,
})

Puts a new file at path with localData 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.

See:

Implementation

Future<http.StreamedResponse> put(
  Uint8List localData,
  PathUri path, {
  DateTime? lastModified,
  DateTime? created,
  String? checksum,
}) async {
  final request = put_Request(
    localData,
    path,
    lastModified: lastModified,
    created: created,
    checksum: checksum,
  );

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

  return streamedResponse;
}