Skip to content
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

The code understanding question #1

Open
engor opened this issue Mar 7, 2024 · 0 comments
Open

The code understanding question #1

engor opened this issue Mar 7, 2024 · 0 comments

Comments

@engor
Copy link

engor commented Mar 7, 2024

Hi. Is there any profit of using

stream = response.asStream().listen(null);
stream?.onData((http.StreamedResponse r) async {
        int fileSize = int.tryParse(r.headers['content-length'] ?? '-1') ?? -1;
        reader = ChunkedStreamReader(r.stream);

instead of

int fileSize = response.contentLength ?? -1;
reader = ChunkedStreamReader(response.stream);

?

It seems the second case give us the same speed but is little cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant