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

When CancelToken.cancel cancels the request and the request times out, StateError is thrown #2182

Closed
gaochang1993 opened this issue Apr 11, 2024 · 1 comment
Labels
i: duplicate This issue or pull request already exists

Comments

@gaochang1993
Copy link

Package

dio

Version

5.4.1

Operating-System

Android

Adapter

Default Dio

Output of flutter doctor -v

[!] Flutter (Channel [user-branch], 3.19.3, on macOS 14.3.1 23D60 darwin-arm64, locale zh-Hans-CN)
    ! Flutter version 3.19.3 on channel [user-branch] at /Users/gaochang/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
    • Framework revision ba39319843 (5 weeks ago), 2024-03-07 15:22:21 -0600
    • Engine revision 2e4ba9c6fb
    • Dart version 3.3.1
    • DevTools version 2.31.1
    • Pub download mirror https://mirrors.tuna.tsinghua.edu.cn/dart-pub
    • Flutter download mirror https://storage.flutter-io.cn
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/gaochang/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/gaochang/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.13.0

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

[✓] Android Studio (version 2022.3)
    • 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.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Community Edition (version 2023.1.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 231.9161.14
                                                                                                                                                                                                                                      [✓] Connected device (4 available)
    • ANA AN00 (mobile)          • CTN0220321020258                     • android-arm64  • Android 12 (API 31)
    • iPhone 15 Pro Max (mobile) • 61B33049-5986-4BF0-AC39-4F9422DC6A81 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator)
    • macOS (desktop)            • macos                                • darwin-arm64   • macOS 14.3.1 23D60 darwin-arm64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 123.0.6312.107

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

! Doctor found issues in 1 category.

Dart Version

3.3.1

Steps to Reproduce

1.Initiate a network request that will timeout
2.cancel the request by call CancelToken.cancel()
3.wait for timeout

Expected Result

nothing happed or throw cancel exception

Actual Result

throw StateError: Bad state: Cannot add event after closing

@gaochang1993 gaochang1993 added h: need triage This issue needs to be categorized s: bug Something isn't working labels Apr 11, 2024
@AlexV525
Copy link
Member

Duplicate of #2115

@AlexV525 AlexV525 marked this as a duplicate of #2115 Apr 11, 2024
@AlexV525 AlexV525 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2024
@AlexV525 AlexV525 added i: duplicate This issue or pull request already exists and removed h: need triage This issue needs to be categorized s: bug Something isn't working labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants