dio icon indicating copy to clipboard operation
dio copied to clipboard

🐛 Bug Report: Inaccurate Timeout Type Detection in Dio

Open quachcuong1990 opened this issue 5 months ago • 3 comments

Package

dio

Version

5.7.0

Operating-System

Web

Adapter

Default Dio

Output of flutter doctor -v

[✓] Flutter (Channel stable, 3.32.0, on macOS 15.3.1 24D70 darwin-arm64, locale en-VN) [2.6s]
    • Flutter version 3.32.0 on channel stable at /Users/buimanhhung/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision be698c48a6 (8 weeks ago), 2025-05-19 12:59:14 -0700
    • Engine revision 1881800949
    • Dart version 3.8.0
    • DevTools version 2.45.1

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [6.1s]
    • Android SDK at /Users/buimanhhung/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2) [8.7s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [12ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.3) [11ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)

[✓] VS Code (version 1.98.2) [10ms]
    • VS Code at /Users/buimanhhung/Downloads/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available) [7.4s]
    • Bui Manh Hung’s iPhone (wireless) (mobile) • 00008101-000619A81A61001E            • ios            • iOS 18.5 22F76
    • iPhone 11 Pro (mobile)                     • C08E6122-4F6C-4C88-AC1F-E9DF1D903CCF • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • Chrome (web)                               • chrome                               • web-javascript • Google Chrome 138.0.7204.101

[✓] Network resources [563ms]
    • All expected network resources are available.

• No issues found!

Dart Version

3.8.0

Steps to Reproduce

final dio = Dio( BaseOptions( connectTimeout: Duration(seconds: 30), receiveTimeout: Duration(seconds: 30), sendTimeout: Duration(seconds: 30), ), );

dio.interceptors.add(InterceptorsWrapper( onError: (DioException error, handler) { if (error.type == DioExceptionType.connectionTimeout) { print('❌ Connection timeout'); } else if (error.type == DioExceptionType.receiveTimeout) { print('❌ Receive timeout'); } else { print('❌ Other error: ${error.message}'); } return handler.next(error); }, ));

await dio.get('https://xxxx');

Expected Result

Actual: receiveTimeout

Actual Result

connectionTimeout (Note: In this case, I'm just requesting a large amount of data, and my network connection is stable.)

quachcuong1990 avatar Jul 12 '25 02:07 quachcuong1990

It works accurately on the mobile platform but not on the web platform.

quachcuong1990 avatar Jul 13 '25 02:07 quachcuong1990

I have the same problem.

xilost avatar Aug 25 '25 07:08 xilost

any update?

oscarshaitan avatar Oct 24 '25 17:10 oscarshaitan