Coder Social home page Coder Social logo

dart-sdk's People

Contributors

2788 avatar carlji avatar huangbinjie avatar seven-cm avatar shirne avatar yinxulai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dart-sdk's Issues

库冲突

七牛库和很多其他的库都有crypto的冲突,类似lottie, auto_router等等,应该尽快升级库
Because auto_route_generator >=1.0.2 depends on build ^2.0.0 which depends on crypto ^3.0.0, auto_route_generator >=1.0.2 requires crypto ^3.0.0.
And because every version of qiniu_sdk_base depends on crypto ^2.1.5, auto_route_generator >=1.0.2 is incompatible with qiniu_sdk_base.
And because qiniu_flutter_sdk 0.2.0 depends on qiniu_sdk_base ^0.2.0 and no versions of qiniu_flutter_sdk match >0.2.0 <0.3.0, auto_route_generator >=1.0.2 is incompatible with qiniu_flutter_sdk ^0.2.0.
So, because ahlan_shop depends on both qiniu_flutter_sdk ^0.2.0 and auto_route_generator ^1.0.2, version solving failed.
pub get failed (1; So, because ahlan_shop depends on both qiniu_flutter_sdk ^0.2.0 and auto_route_generator ^1.0.2, version solving failed.)

不支持上传到东南亚地域

上传到东南亚地域,会报如下错,也没有提供可以指定地域的方法
lutter: StorageError [StorageErrorType.RESPONSE, 400]: {error: incorrect region, please use up-as0.qiniup.com, bucket is: english-word1}

表单上传的key不是必填字段

根据官网API文档
https://developer.qiniu.com/kodo/1312/upload

表单上传里的key在服务端不是必填字段

final formDataMap = <String, dynamic>{
'file': multipartFile,
'token': token,
'key': resource.name,

但这里即使resource.name == null,dio也会默认填充空字符串
https://github.com/cfug/dio/blob/adc6842d6664d427bb06bc44aa870340bd127ef4/dio/lib/src/form_data.dart#L29

需要加上if (resource.name != null) 'key': resource.name

麻烦问一下,上传报错的问题

我的DIO版本号是: dio: ^5.2.1+1
sdk是:0.5.0
上传图片提示这个错,但是不影响上传。

[🔔 Dio] _MultiStream<List<int>> cannot be used to imply a default content-type, please set a proper content-type in the request. #0 ImplyContentTypeInterceptor.onRequest (package:dio/src/interceptors/imply_content_type.dart:45:36) #1 DioMixin.fetch.requestInterceptorWrapper.<anonymous closure>.<anonymous closure> (package:dio/src/dio_mixin.dart:385:26) #2 new Future.<anonymous closure> (dart:async/future.dart:256:37) #3 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15) #4 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19) #5 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5) #6 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12) [🔔 Dio] _MultiStream<List<int>> cannot be used to imply a default content-type, please set a proper content-type in the request. #0 ImplyContentTypeInterceptor.onRequest (package:dio/src/interceptors/imply_content_type.dart:45:36) #1 DioMixin.fetch.requestInterceptorWrapper.<anonymous closure>.<anonymous closure> (package:dio/src/dio_mixin.dart:385:26) #2 new Future.<anonymous closure> (dart:async/future.dart:256:37) #3 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15) #4 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19) #5 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5) #6 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)

如何获取生成upload token ?

SDK内未包含token生成代码,然后就对照该 上传凭证 文档撸了一个token生成的代码. 如下:

出现问题:

  • 401 {error: bad token}
  • 403 {“error”:”key doesn’t match with scope”}
import 'dart:convert';
import 'dart:io';
import 'package:crypto/crypto.dart';
import 'package:path/path.dart';
import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart';

const returnBody ="{\"name\":\$(fname),\"size\":\$(fsize),\"w\":\$(imageInfo.width),\"h\":\$(imageInfo.height),\"hash\":\$(etag)}";
class Qiniu {
  final String _appid;
  final String _secret;
  final String _bucket;
  final Storage _storage = Storage();

  Qiniu(this._appid, this._secret, this._bucket);

  String _signal(fileName) {
    var deadline = DateTime.now().add(Duration(hours: 1));
    var unixTs = deadline.toUtc().millisecondsSinceEpoch / 1000;
    var putPolicy = jsonEncode({
      "scope": "$_bucket:$fileName",
      "deadline": unixTs.toInt(),
      "returnBody": returnBody
    });
    var b64 = base64Encode(utf8.encode(putPolicy));
    var hmacSha1 = Hmac(sha1, utf8.encode(this._secret));
    var d = hmacSha1.convert(utf8.encode(b64));
    var sig = base64Encode(d.bytes);
    return "$_appid:$sig:$b64";
  }

  Future<void> upload(File file, Function callback) async {
    var fn = basename(file.path);
    var token = _signal(fn);
    _storage.putFile(file, token,options: PutOptions(key: "$_bucket:$fn")).then((resp) {
      if (null != callback) {
        Function.apply(callback, [callback]);
      }
    }).catchError((e, s) {
      print(e);
    });
  }
}

找到了,,应该用这个版本。
qiniu_sdk_base 0.3.1

关于缩略图

上传图片后返回的是一个key和hash,那么这种情况如何通过这个访问地址+参数的形式去获取图片的缩略图呢?
如何获取上传图片的缩略图。

分片上传dio报错

_MultiStream<List> cannot be used to imply a default content-type, please set a proper content-type in the request.

support for flutter web

目前的sdk 要求的参数File 不是html.File,无法直接在web中使用。
另外我想在网页中上传图片,用了Flutter官方提供的image_picker_for_web 图片选择插件,不过这个插件所返回的图片对象是没有本地文件地址的,所以无法提供File对象,这样就无法在客户端直传七牛云了,请问七牛能考虑这样的应用场景,提供web版的sdk吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.