qiniu / dart-sdk

Qiniu Resource (Cloud) Storage SDK for Dart
24 stars 25 forks source link

不支持Uint8List的上传了吗? #48

Closed xzhbbc closed 2 years ago

huangbinjie commented 3 years ago

你好,后续打算新增一个 putBytes

disburden commented 3 years ago

你好,后续打算新增一个 putBytes

已经8月份了,还没搞好吗?

huangbinjie commented 3 years ago

@disburden 搞了搞了,最近比较忙,断断续续可算做完了,可以关注下 #50

disburden commented 3 years ago

@disburden 搞了搞了,最近比较忙,断断续续可算做完了,可以关注下 #50

酷酷酷,我去试试

disburden commented 3 years ago

我用你们的demo(token也是用token.dart文件里的)试了一下,好像会报错

  void ontapTestUpload() async {
    print('token:$builtinToken');
    Uint8List? imageData =
        await ImagePickerWeb.getImage(outputType: ImageType.bytes) as Uint8List;
    print('imageData:$imageData');
    await storage.putBytes(imageData, builtinToken!,);
  }

日志: 41, 40, 212, 38, 132, 16, 66, 8, 33, 164, 83, 80, 168, 77, 8, 33, 132, 16, 66, 72, 167, 160, 80, 155, 16, 66, 8, 33, 132, 144, 78, 65, 161, 54, 33, 132, 16, 66, 8, 33, 157, 130, 66, 109, 66, 8, 33, 132, 16, 66, 58, 5, 133, 218, 132, 16, 66, 8, 33, 132, 116, 10, 10, 181, 9, 33, 132, 16, 66, 8, 233, 20, 212, 152, 157, 16, 66, 8, 33, 132, 144, 78, 65, 221, 34, 9, 33, 132, 16, 66, 8, 233, 20, 20, 91, 19, 66, 8, 33, 132, 16, 210, 41, 40, 212, 38, 132, 16, 66, 8, 33, 164, 83, 80, 168, 77, 8, 33, 132, 16, 66, 72, 167, 160, 80, 155, 16, 66, 8, 33, 132, 144, 78, 65, 161, 54, 33, 132, 16, 66, 8, 33, 157, 162, 161, 2, 9, 0, 142, 227, 168, 2, 9, 33, 132, 16, 66, 8, 33, 175, 75, 67, 93, 109, 42, 173, 77, 8, 33, 132, 16, 66, 200, 235, 245, 255, 198, 132, 170, 154, 4, 124, 117, 210, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130] Error: StorageError [StorageErrorType.RESPONSE, 612]: {error: accessKey is not found} Non-error null thrown by JS does not have stack trace. Caught in Dart at:

dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 288:20 missing dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 152:24 stackTrace dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 165:10 stackTraceForError dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 286:33 get stackTrace packages/qiniu_sdk_base/src/error/error.dart 15:18 get stackTrace dart-sdk/lib/async/async_error.dart 26:29 defaultStackTrace dart-sdk/lib/async/future_impl.dart 30:33 completeError packages/qiniu_sdk_base/src/storage/task/task.dart 43:15 postError packages/qiniu_sdk_base/src/storage/task/request_task.dart 205:3 [postError] packages/qiniu_sdk_base/src/storage/task/request_task.dart 129:13 postError$ dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async packages/qiniu_sdk_base/src/storage/task/request_task.dart 91:17 postError dart-sdk/lib/async/zone.dart 1613:54 runUnary dart-sdk/lib/async/future_impl.dart 172:20 handleError dart-sdk/lib/async/future_impl.dart 719:46 handleError dart-sdk/lib/async/future_impl.dart 740:13 _propagateToListeners dart-sdk/lib/async/future_impl.dart 550:5 [_completeError] dart-sdk/lib/async/future_impl.dart 61:12 [_completeError] dart-sdk/lib/async/future_impl.dart 33:5 completeError dart-sdk/lib/async/future.dart 466:44 onError dart-sdk/lib/async/zone.dart 1618:54 runBinary dart-sdk/lib/async/future_impl.dart 169:20 handleError dart-sdk/lib/async/future_impl.dart 719:46 handleError dart-sdk/lib/async/future_impl.dart 740:13 _propagateToListeners dart-sdk/lib/async/future_impl.dart 550:5 [_completeError] dart-sdk/lib/async/future_impl.dart 606:7 callback dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15

前面一堆数字是我图片生成的Uint8List,不知道你们demo是不是还要改什么

disburden commented 3 years ago

我改成了自己生成的token,错误变成了这样

Error: StorageError [StorageErrorType.UNKNOWN, null]: Unsupported operation: Platform._version dart-sdk/lib/_internal/js_dev_runtime/private/ddcruntime/errors.dart 236:49 throw dart-sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart 289:5 _version dart-sdk/lib/io/platform_impl.dart 117:32 get version dart-sdk/lib/io/platform.dart 67:37 get _version dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 825:8 get dart-sdk/lib/io/platform.dart 184:32 get version dart-sdk/lib/_http/http_impl.dart 3709:26 _getHttpVersion dart-sdk/lib/_http/http_impl.dart 2514:23 new dart-sdk/lib/_http/http.dart 1563:18 new packages/dio/src/adapters/io_adapter.dart 132:28 [_configHttpClient] packages/dio/src/adapters/io_adapter.dart 34:23 fetch dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async packages/dio/src/adapters/io_adapter.dart 25:29 fetch packages/dio/src/dio_mixin.dart 632:46 _dispatchRequest dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50 dart-sdk/lib/async/zone.dart 1613:54 runUnary dart-sdk/lib/async/future_impl.dart 155:18 handleValue dart-sdk/lib/async/future_impl.dart 707:44 handleValueCallback dart-sdk/lib/async/future_impl.dart 736:13 _propagateToListeners dart-sdk/lib/async/future_impl.dart 542:5 [_completeWithValue] dart-sdk/lib/async/future_impl.dart 580:7 callback dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15

huangbinjie commented 3 years ago

之前就碰到过这个问题。。看起来是是 dio 用了 dart:io 这个包,他在 web 上不支持。我这个 pr 的目前是奔着支持 Uint8List 上传去的,web 还没办法保障

disburden commented 3 years ago

那现在支持Uint8List上传了吗?

yinxulai commented 3 years ago

那现在支持Uint8List上传了吗?

依旧在开发状态 #50 目前依赖的 dio 依旧无法支持 web 平台,所以 web 平台还尚未支持

yinxulai commented 2 years ago

@disburden @xzhbbc 0.4.0 已经发布,支持 web https://pub.dev/packages/qiniu_flutter_sdk 欢迎报告问题