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

Dio REST call response is slow than Postman #2100

Closed
devsideal opened this issue Jan 19, 2024 · 5 comments
Closed

Dio REST call response is slow than Postman #2100

devsideal opened this issue Jan 19, 2024 · 5 comments

Comments

@devsideal
Copy link

Package

dio

Version

5.3.2

Operating-System

Android, iOS

Output of flutter doctor -v

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.0, on Ubuntu 22.04.3 LTS 6.5.0-14-generic, locale en_IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✗] Linux toolchain - develop for Linux desktop
    ✗ clang++ is required for Linux development.
      It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
    ✗ CMake is required for Linux development.
      It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases
    ✗ pkg-config is required for Linux development.
      It is likely available from your distribution (e.g.: apt install pkg-config), or can be downloaded from https://www.freedesktop.org/wiki/Software/pkg-config/
[✓] Android Studio (version 2023.1)
[✓] VS Code (version unknown)
    ✗ Unable to determine VS Code version.
[✓] Connected device (3 available)
[✓] Network resources

Dart Version

3.1.0

Steps to Reproduce

  • Just send a simple Get request and calculate response time
  • Do the same thing with Postman and see the response time is much lesser than Dio.

I experimented with various APIs, and the outcomes were consistently similar, with Dio resulting in approximately three times longer response times, See the differences below:

api-response

Expected Result

Do Rest call response time should correct time that can be measure with postman

Actual Result

Geetting Api response time approx 3x longer than Postman

@devsideal devsideal added h: need triage This issue needs to be categorized s: bug Something isn't working labels Jan 19, 2024
@devsideal devsideal changed the title Dio Rest call response is slow than Postman Dio REST call response is slow than Postman Jan 19, 2024
@AlexV525
Copy link
Member

Please try HttpClient.

@devsideal
Copy link
Author

@AlexV525 Looks simmilar with HttpClient too

Screenshot from 2024-01-19 15-21-41

@AlexV525
Copy link
Member

Thanks for the verification. There is nothing Dio can do here, which is likely an underlying platform issue.

@AlexV525 AlexV525 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 19, 2024
@AlexV525 AlexV525 added i: out of support and removed h: need triage This issue needs to be categorized s: bug Something isn't working labels Jan 19, 2024
@devsideal
Copy link
Author

Thanks @AlexV525 for the confirmation, FYI, I posted the same for flutter community as well.

@kuhnroyal
Copy link
Member

kuhnroyal commented Jan 25, 2024

You can try to use the native_dio_adapter which uses the cronet client on Android via FFI. That might be more performant.

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

No branches or pull requests

3 participants