-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StreamedRequest.sink should be a StreamSink #727
Labels
type-enhancement
A request for a change that isn't a bug
Comments
@brianquinlan - this is technically breaking if any use case has an |
natebosch
added a commit
that referenced
this issue
Jun 16, 2023
Closes #727 This class was not designed for extension, but there is at least one extending implementation. I don't see any overrides of this field, so no existing usage should be broken.
Seems fine to me...I probably should have made Maybe note the potential breakage in the changelog? |
natebosch
added a commit
that referenced
this issue
Jun 20, 2023
Closes #727 This class was not designed for extension, but there is at least one extending implementation. I don't see any overrides of this field, so no existing usage should be broken. Some new lints may surface for unawaited futures - the returned futures should not be awaited.
781flyingdutchman
added a commit
to 781flyingdutchman/background_downloader
that referenced
this issue
Oct 20, 2023
Caused by buffering of the stream, giving the impression the entire file is uploaded very quickly. Changed to a different streaming mechanism using StreamSink instead of EventSink, see dart-lang/http#727
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now
StreamedRequest.sink
is declared as anEventSink<List<int>>
:However, the sink of a
StreamController
is a child classStreamSink
, which has useful methods likeaddStream
: https://api.dart.dev/stable/2.17.5/dart-async/StreamConsumer/addStream.htmlBeing able to add a stream using this method is essential if you need the stream to be paused when the send buffer is full, e.g. if you are reading from disk faster than you can send it over the network.
Here's a simple example showing how a StreamController is notified when the send buffer is full:
Outputs:
My proposal is just a 1 line change to the getter:
This would also allow us to get upload progress events without adding any callbacks to post / send:
The text was updated successfully, but these errors were encountered: