asMultipartPart method
Creates a one-shot streaming part. Do not modify the file during upload. One-shot semantics prevent automatic retries of a changing file.
Implementation
Future<MultipartPart> asMultipartPart(
{required String name,
String? filename,
String contentType = 'application/octet-stream'}) async {
final size = await length();
return MultipartPart(
name: name,
filename: filename ?? uri.pathSegments.last,
body: StreamRequestBody(openRead(),
contentLength: size, contentType: contentType));
}