We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
dio
5.4.0
Android, Windows
Default Dio
flutter doctor -v
[✓] Flutter (Channel stable, 3.19.6, on macOS 13.6.3 22G436 darwin-x64, locale zh-Hans-CN) • Flutter version 3.19.6 on channel stable at /Users/ieducc/develop/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 54e66469a9 (8 weeks ago), 2024-04-17 13:08:03 -0700 • Engine revision c4cd48e186 • Dart version 3.3.4 • DevTools version 2.31.1 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/ieducc/Library/Android/sdk • Platform android-34, build-tools 33.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15C500b • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2023.2) • 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.9+0-17.0.9b1087.7-11185874) [✓] VS Code (version 1.90.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.90.0 [✓] Connected device (3 available) • V1901A (mobile) • ZDZ9DA7PAEV8H6Y9 • android-arm64 • Android 9 (API 28) • macOS (desktop) • macos • darwin-x64 • macOS 13.6.3 22G436 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 125.0.6422.142
=2.17
i upload file to OSS, If the upload is not successful within the timeout period, report send timeout
code: // CommonConstants.sendTimeout=Duration(seconds: 30)
MediaType contentType = MediaType.parse(lookupMimeType(newFileName)!); var multipartFile = await MultipartFile.fromFile(file!.path.substring(1, file.path.length), filename: fileName, contentType: contentType); String ossFilePath = "${DateFormat("yyyy-MM-dd").format(DateTime.now())}/$newFileName"; var params = { 'Filename': newFileName, //文件名,随意 'key': ossFilePath, //"可以填写文件夹名(对应于oss服务中的文件夹)/" + fileName 'policy': OssUtil.policy, 'OSSAccessKeyId': data["accessKeyId"], //Bucket 拥有者的AccessKeyId。 'success_action_status': '200', //让服务端返回200,不然,默认会返回204 'Signature': OssUtil.instance.getSignature(data["accessKeySecret"]), 'x-oss-security-token': data["securityToken"], //临时用户授权时必须,需要携带后台返回的security-token 'file': multipartFile //必须放在参数最后 }; FormData formData = FormData.fromMap(params); if (isShowLoading == true) { LoadingDialog.showLoading(text: "正在上传文件"); } Dio dio = Dio( BaseOptions( sendTimeout: CommonConstants.sendTimeout, receiveTimeout: CommonConstants.receiveTimeout, responseType: ResponseType.plain, contentType: "multipart/form-data", ), ); await dio .post(_OSS_URL, data: formData, onSendProgress: onSendProgress, cancelToken: cancelToken) .catchError((error) { LoadingDialog.hideLoading(); throw error; });
希望超时时间为每次上传的间隔时间, 而不是整个上传过程的总时间
log:
I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.265242, count:29, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.266898, count:80, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.269333, count:116, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.271244, count:118, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.273055, count:147, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.274660, count:193, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.276476, count:240, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.278267, count:242, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.280623, count:271, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.283430, count:320, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.286130, count:452, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.289377, count:454, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.291471, count:483, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.293892, count:540, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.296136, count:569, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.298127, count:571, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.300479, count:600, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.303025, count:664, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.305658, count:667, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.308622, count:669, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.310961, count:698, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:16.313502, count:750, total:41867665 .... I/flutter ( 9504): INFO [I] 2024-06-14 09:27:44.463712, count:14616169, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:44.818331, count:14681705, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:44.833786, count:14747241, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:45.149336, count:14812777, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:45.165853, count:14878313, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:45.402073, count:14943849, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:45.416265, count:15009385, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:45.642641, count:15074921, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:45.659955, count:15140457, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:45.861150, count:15205993, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:46.227944, count:15271529, total:41867665 I/flutter ( 9504): INFO [I] 2024-06-14 09:27:46.248611, count:15337065, total:41867665 I/flutter ( 9504): WARNING [W] DioException [send timeout]: The request took longer than 0:00:30.000000 to send data. It was aborted. To get rid of this exception, try raising the RequestOptions.sendTimeout above the duration of 0:00:30.000000 or improve the response time of the server.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Package
dio
Version
5.4.0
Operating-System
Android, Windows
Adapter
Default Dio
Output of
flutter doctor -v
Dart Version
Steps to Reproduce
i upload file to OSS, If the upload is not successful within the timeout period, report send timeout
code: // CommonConstants.sendTimeout=Duration(seconds: 30)
Expected Result
希望超时时间为每次上传的间隔时间, 而不是整个上传过程的总时间
Actual Result
log:
The text was updated successfully, but these errors were encountered: