From a8563c4e67d6a1dbee6939a9e8ec345f5d4ae72b Mon Sep 17 00:00:00 2001 From: gabrielaraujoz Date: Mon, 24 Jul 2023 14:22:14 -0300 Subject: [PATCH] remove _stream in favor of data --- dio/lib/src/multipart_file.dart | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/dio/lib/src/multipart_file.dart b/dio/lib/src/multipart_file.dart index 408df6fa6..08bf153d5 100644 --- a/dio/lib/src/multipart_file.dart +++ b/dio/lib/src/multipart_file.dart @@ -29,8 +29,7 @@ class MultipartFile { Map>? headers, }) : _data = data, headers = caseInsensitiveKeyMap(headers), - contentType = contentType ?? MediaType('application', 'octet-stream'), - _stream = data.call(); + contentType = contentType ?? MediaType('application', 'octet-stream'); /// The size of the file in bytes. This must be known in advance, even if this /// file is created from a [ByteStream]. @@ -45,9 +44,6 @@ class MultipartFile { /// The content-type of the file. Defaults to `application/octet-stream`. final MediaType? contentType; - /// The stream that will emit the file's contents. - final Stream> _stream; - // The stream builder that will emit the file's contents for every call. final Stream> Function() _data; @@ -144,7 +140,7 @@ class MultipartFile { ); } _isFinalized = true; - return _stream; + return _data.call(); } /// Clone MultipartFile, returning a new instance of the same object.