Skip to content

[native_dio_adapter] NativeAdapter ignores timeout options (sendTimeout, connectTimeout, receiveTimeout) #2457

@koji-1009

Description

@koji-1009

Package

native_dio_adapter

Version

1.5.0

Operating-System

Android, iOS

Adapter

ConversionLayerAdapter

Output of flutter doctor -v

[✓] Flutter (Channel stable, 3.35.7, on macOS 26.1 25B78 darwin-arm64, locale
    ja-JP) [406ms]
    • Flutter version 3.35.7 on channel stable at /Users/koji/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision adc9010625 (3 weeks ago), 2025-10-21 14:16:03 -0400
    • Engine revision 035316565a
    • Dart version 3.9.2
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop,
      enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [2.9s]
    • Android SDK at /Users/koji/Library/Android/sdk
    • Emulator version 36.2.12.0 (build_id 14214601) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • ANDROID_HOME = /Users/koji/Library/Android/sdk
    • 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.8+-14196175-b1038.72)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.1) [1,545ms]
    • Xcode at /Applications/Xcode-26.1.0.app/Contents/Developer
    • Build 17B55
    • CocoaPods version 1.16.2

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

[✓] Android Studio (version 2025.2) [64ms]
    • 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.8+-14196175-b1038.72)

[✓] IntelliJ IDEA Community Edition (version 2025.2) [63ms]
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 87.1
    • Dart plugin version 252.24322.5

[✓] VS Code (version 1.105.1) [4ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.122.0

[✓] Connected device (2 available) [5.8s]
    • macOS (desktop) • macos  • darwin-arm64   • macOS 26.1 25B78 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 142.0.7444.60

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

• No issues found!

Dart Version

3.9.2

Steps to Reproduce

  1. Configure Dio's BaseOptions with a very short timeout (e.g., connectTimeout).
    final dio = Dio(
      BaseOptions(
        connectTimeout: const Duration(microseconds: 10),
        // or sendTimeout / receiveTimeout
      ),
    );
  2. Ensure NativeAdapter is used as the httpClientAdapter.
    dio.httpClientAdapter = NativeAdapter();
  3. Make a network request using this Dio instance to an endpoint that takes longer than the specified timeout.
    try {
      await dio.get('https://example.com'); 
    } catch (e) {
      print(e);
    }

Expected Result

The request should fail almost immediately due to the extremely short timeout (10 microseconds), and a DioException should be thrown with type set to DioExceptionType.connectTimeout (or the corresponding timeout type).

Actual Result

The configured timeout (e.g., connectTimeout: const Duration(microseconds: 10)) is ignored.

The request proceeds as if no timeout was set. If the network connection is successful, the request succeeds.
On iOS devices, the request eventually times out after approximately 60 seconds, which appears to be the underlying OS-level default timeout, proving that Dio's specific timeout setting was not applied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    h: need triageThis issue needs to be categorizeds: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions