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

Use StreamedRequest with onSendProgress in adapter #1901

Closed
wants to merge 2 commits into from

Conversation

Vovcharaa
Copy link
Contributor

Fix #1835

New Pull Request Checklist

  • I have read the Documentation
  • I have searched for a similar pull request in the project and found none
  • I have updated this branch with the latest main branch to avoid conflicts (via merge from master or rebase)
  • I have added the required tests to prove the fix/feature I'm adding
  • I have updated the documentation (if necessary)
  • I have run the tests without failures
  • I have updated the CHANGELOG.md in the corresponding package

Additional context and info (if any)

@SpeedReach
Copy link
Contributor

Hello are you still working on this issue? I could complete this if you're too busy.

@Vovcharaa
Copy link
Contributor Author

Vovcharaa commented Oct 1, 2023

Hello are you still working on this issue? I could complete this if you're too busy.

You can take the lead in finalizing this feature.
But it is not possible to finish it right now. Check this dart-lang/http#997.
StreamSink in cupertino_http is buffering data and I don't know how to prevent this behavior so this feature won't work as intended. This must be handled on the cupertino_http side.

@SpeedReach
Copy link
Contributor

I just tested with a larger data (more than 1024 bytes) according to dart-lang/http#997 (comment)
and it works fine.

  final dio = Dio()..httpClientAdapter = NativeAdapter();
  String superLargeData = 'aaa';
  for(int i=0;i<1000;i++){
    superLargeData += 'wwwww';
  }
  final res = await dio.post(
      "url",
      data: superLargeData,
      onSendProgress: (a,b){
        print('$a $b');
      }
  );

output:

flutter: 1024 5003
flutter: 2048 5003
flutter: 3072 5003
flutter: 4096 5003
flutter: 5003 5003

@AlexV525
Copy link
Member

@Vovcharaa Are you still on this?
@SpeedReach If you want to continue based on the current work, please merge previous commits into your new branch to keep everyone's contributions recorded. Thanks.

@SpeedReach
Copy link
Contributor

The changes @Vovcharaa made already completes the issue, but he didn't test it with data larger than the buffer, so he thought it didn't work.
This branch can be merged directly I think.

@AlexV525
Copy link
Member

I looked at the implementation again and found I did the same thing in the new adapter. This can be easily addressed once we switch to the new adapter #1976.

@AlexV525 AlexV525 closed this Dec 11, 2023
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

Successfully merging this pull request may close these issues.

native_dio_adapter does not support onReceiveProgress and onSendProgress
3 participants