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

当后端返回字节流dio无法解析 #2110

Closed
renzhenxuexi0 opened this issue Feb 12, 2024 · 0 comments
Closed

当后端返回字节流dio无法解析 #2110

renzhenxuexi0 opened this issue Feb 12, 2024 · 0 comments

Comments

@renzhenxuexi0
Copy link

Package

dio

Version

5.4.0

Operating-System

Android

Output of flutter doctor -v

Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
[✓] Flutter (Channel stable, 3.16.9, on Microsoft Windows [版本 10.0.22635.3130], locale zh-CN)
    • Flutter version 3.16.9 on channel stable at D:\SDK\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 41456452f2 (3 weeks ago), 2024-01-25 10:06:23 -0800
    • Engine revision f40e976bed
    • Dart version 3.2.6
    • DevTools version 2.28.5
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\wuhaiyue\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Users\wuhaiyue\AppData\Local\Programs\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = C:\Program Files\Google\Chrome Dev\Application\chrome.exe

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.0)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.8.34309.116
    • Windows 10 SDK version 10.0.22621.0

[✓] Android Studio (version 2023.1)
    • Android Studio at C:\Users\wuhaiyue\AppData\Local\Programs\Android Studio
    • 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-b2043.56-10550314)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.3)
    • IntelliJ at C:\Users\wuhaiyue\AppData\Local\Programs\IntelliJ IDEA Ultimate
    • 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.86.0)
    • VS Code at C:\Users\wuhaiyue\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.82.0

[✓] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 14 (API 34) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [版本 10.0.22635.3130]
    • Chrome (web)                 • chrome        • web-javascript • unknown
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 121.0.2277.112

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

• No issues found!

Dart Version

3.2.6

Steps to Reproduce

简单的发起了一个请求
final response = await dio.get(
ApiMethods.getImage(minioFileRecordId: minioFileRecordId),
cancelToken: cancelToken,
options: Options(
responseType: ResponseType.bytes,
),
);

Expected Result

得到图片数据Uint8List.fromList(response.data);

Actual Result

I/flutter (20564): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (20564): │ DioException [unknown]: null
I/flutter (20564): │ Error: type 'Uint8List' is not a subtype of type 'Map<String, dynamic>' in type cast
I/flutter (20564): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (20564): │ #0 DioMixin.fetch. (package:dio/src/dio_mixin.dart:507:7)
I/flutter (20564): │ #1 _FutureListener.handleError (dart:async/future_impl.dart:180:22)
I/flutter (20564): │ #2 Future._propagateToListeners.handleError (dart:async/future_impl.dart:858:47)
I/flutter (20564): │ #3 Future._propagateToListeners (dart:async/future_impl.dart:879:13)
I/flutter (20564): │ #4 Future._completeError (dart:async/future_impl.dart:655:5)
I/flutter (20564): │ #5 _SyncCompleter._completeError (dart:async/future_impl.dart:63:12)
I/flutter (20564): │ #6 _Completer.completeError (dart:async/future_impl.dart:27:5)
I/flutter (20564): │ #7 Future.any.onError (dart:async/future.dart:618:45)
I/flutter (20564): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (20564): │ 08:18:24.105 (+0:08:38.233908)

@renzhenxuexi0 renzhenxuexi0 added h: need triage This issue needs to be categorized s: bug Something isn't working labels Feb 12, 2024
@AlexV525 AlexV525 added i: not related and removed h: need triage This issue needs to be categorized s: bug Something isn't working labels Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants