cfug/dio

Dio cannot connect to the Internet after VPN is enabled on iOS devices

Closed this issue · 1 comments

Package

dio

Version

5.5.0

Operating-System

iOS

Adapter

Default Dio

Output of flutter doctor -v

[✓] Flutter (Channel stable, 3.22.3, on macOS 14.5 23F79 darwin-arm64 (Rosetta), locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.92.0-insider)
[✓] Connected device (4 available)
[✓] Network resources

Dart Version

3.4.4

Steps to Reproduce

  1. enable the vpn in iphone
  2. dio request will get the timeout error

Expected Result

the response code is 200

Actual Result

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: DioException [connection timeout]: The request connection took longer than 0:00:10.000000 and it was aborted. To get rid of this exception, try raising the RequestOptions.connectTimeout above the duration of 0:00:10.000000 or improve the response time of the server.
#0 DioMixin.fetch (package:dio/src/dio_mixin.dart:519:7)

#1 HttpUtil.get (package:surflare/util/http_util.dart:127:18)

The implementation is regardless of the network environment. Please check if your VPN is working.