You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to have a way to get the upload progress of multipart requests. An example of how to achieve this with http package can be found here.
Maybe by adding a new annotation? Something like:
@Post(path:'/file')
@Multipart()
Future<Response<void>> uploadFile(
@Query('filename') String fileName,
@PartFile() String filePath,
/// A callback that take the progress of the upload as a double between 0 and 1@ProgressCallback() voidFunction(double) progressCallback,
);
The text was updated successfully, but these errors were encountered:
When looking at the example it looks like its actually using the HttpClient from dart.io instead of http dart package which chopper is using. Reading into some more documentation the http package lists using StreamedRequest as a possibility.
I think it take a bit more investigation on figuring out how too get the progress :)
Looks to me that the easy way to do this would be to extend the http packages MultipartRequest and override the finalize method to include the progress callback.
Is there any appetite to do that within this library or is the plan to just wait for something like the following which doesn't seem to be getting the attention that it deserves. dart-lang/http#579
Haven't had the time to further investigate this. There is also this dart-lang/http#728 PR which has a bit more attention and also adds a upload progress to the http client. Would be nice if it was included and easier intergrading in chopper. But that no guarantee.
What I did look into was that it might be possible to finalize the MultipartRequest which results in a ByteStream which maybe could be used in a StreamedRequest. This could be done by creating a extended MultipartRequest or just a method converting the MultipartRequest to StreamedRequest. But feels a bit hacky converting the Request types.
It would be great to have a way to get the upload progress of multipart requests. An example of how to achieve this with http package can be found here.
Maybe by adding a new annotation? Something like:
The text was updated successfully, but these errors were encountered: