Skip to content

Commit

Permalink
remove _stream in favor of data
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielaraujoz committed Jul 24, 2023
1 parent 3499783 commit a8563c4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions dio/lib/src/multipart_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class MultipartFile {
Map<String, List<String>>? 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].
Expand All @@ -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<List<int>> _stream;

// The stream builder that will emit the file's contents for every call.
final Stream<List<int>> Function() _data;

Expand Down Expand Up @@ -144,7 +140,7 @@ class MultipartFile {
);
}
_isFinalized = true;
return _stream;
return _data.call();
}

/// Clone MultipartFile, returning a new instance of the same object.
Expand Down

0 comments on commit a8563c4

Please sign in to comment.