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

DioException [unknown]: null #2387

Open
choim4389 opened this issue Mar 5, 2025 · 1 comment
Open

DioException [unknown]: null #2387

choim4389 opened this issue Mar 5, 2025 · 1 comment
Labels
h: need triage This issue needs to be categorized s: bug Something isn't working

Comments

@choim4389
Copy link

Package

dio

Version

5.8.0

Operating-System

Android, iOS

Adapter

Default Dio

Output of flutter doctor -v

[✓] Flutter (Channel stable, 3.27.2, on macOS 14.5 23F79 darwin-arm64, locale
    ko-KR)
    • Flutter version 3.27.2 on channel stable at
      /Users/macan/.asdf/installs/flutter/3.27.2-stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 68415ad1d9 (7 weeks ago), 2025-01-13 10:22:03 -0800
    • Engine revision e672b006cb
    • Dart version 3.6.1
    • DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version
    34.0.0)
    • Android SDK at /Users/macan/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • ANDROID_HOME = /Users/macan/Library/Android/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

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

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

[✓] Android Studio (version 2023.1)
    • 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
      17.0.7+0-17.0.7b1000.6-10550314)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • 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

[✓] VS Code (version 1.96.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.94.0

[✓] Connected device (4 available)
    • SM S928N (mobile)               • R3CWC0MBFQP           • android-arm64
      • Android 14 (API 34)
    • macOS (desktop)                 • macos                 • darwin-arm64
      • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin
      • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                    • chrome                •
      web-javascript • Google Chrome 133.0.6943.142
    ! Error: Browsing on the local area network for iPhone (4). Ensure the
      device is unlocked and attached with a cable or associated with the
      same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly.
      (code -27)

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

Dart Version

3.6.1

Steps to Reproduce

initialize firebase crashlytics

PlatformDispatcher.instance.onError = (error, stack) {
    FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
    return true;
  };

then create dio client.

Expected Result

no exception logged

Actual Result

In crashlytics, DioException [unknown]: null is always logged at the beginning, even when no request is made.

@choim4389 choim4389 added h: need triage This issue needs to be categorized s: bug Something isn't working labels Mar 5, 2025
@buthmathearo
Copy link

buthmathearo commented Mar 13, 2025

This happened to me when I tried to call 2 APIs at same time. This is the error message:
DioException [unknown]: null
Error: HttpException: Content size below specified contentLength. 0 bytes written but expected 125

For example:
void initState() {
_getAppInfo(); // Call get app info API in the background.
_getAccountInfo(); // Call get user account info API in the background.
}

Adding some delay between the _getAppInfo() and _getAccountInfo() will temporarily fix this. But it's not a good option.

*** Update ****
In my case, the issue is from the certificate_pinning_httpclient package. There is a bug in CertificatePinningHttpClient.openUrl () when a race condition occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
h: need triage This issue needs to be categorized s: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants