Giter Site home page Giter Site logo

Comments (16)

quanzaiyu avatar quanzaiyu commented on July 21, 2024 4

flutter我试过, 使用 dio 可以很容易地上传到oss, 封装的部分代码如下:

  oss(File file) async {
    var ext = file.path.split('.').last;
    var userId = (await Storage.get('userInfo'))['id'].toString();
    var now = (new DateTime.now()).toString();
    var uuid = new Uuid();
    var filename = uuid.v5(Uuid.NAMESPACE_URL, now + userId);

    // 签名
    FormData data = new FormData.from({
      'Filename': '文件名,随意',
      'key' : "$uploadBaseUrl/$filename.$ext",
      'policy': policyBase64,
      'OSSAccessKeyId': accesskeyId,
      'success_action_status' : '200', //让服务端返回200,不然,默认会返回204
      'signature': signature,
      'file': new UploadFileInfo(file, "imageFileName")
    });

    try {
      Response response = await dio.post(ossPath, data: data);
      var uploadPath = "$ossPath/$uploadBaseUrl/$filename.$ext";
      print(response);
      print("上传成功: $uploadPath");
      return uploadPath;
    } on DioError catch(e) {
      print("上传失败: $e");
    }
  }

from aliyun-oss-react-native.

luozhang002 avatar luozhang002 commented on July 21, 2024

@jlcool 团队已经有小伙伴开始调研。

from aliyun-oss-react-native.

Liangqianyong avatar Liangqianyong commented on July 21, 2024

flutter 版本的sdk 出了吗

from aliyun-oss-react-native.

luozhang002 avatar luozhang002 commented on July 21, 2024

@Liangqianyong 出一整套的方案的话,成本太高,有个基于postobject的flutter sdk你可以参考下。https://github.com/luozhang002/postflutter-demo

此外网上也有第三方用户开发了一个 flutteross插件,也可以参考下。
https://github.com/jlcool/aliossflutter

from aliyun-oss-react-native.

linguitang avatar linguitang commented on July 21, 2024

@luozhang002 其实官方可以根据android和ios的官方sdk,出一个flutter插件就好了

from aliyun-oss-react-native.

chenjianjun571 avatar chenjianjun571 commented on July 21, 2024

官方什么时候出flutter插件库呀?大势所趋,阿里云能不能跟上时代的步伐呀

from aliyun-oss-react-native.

Stuazt avatar Stuazt commented on July 21, 2024

还是没有flutter库啊,https://github.com/jlcool/aliossflutter ,这个不够强壮,感觉作者并没有在生产环境中使用,不然也不会那么多bug。。。作者也好久没维护了。

from aliyun-oss-react-native.

jlcool avatar jlcool commented on July 21, 2024

@luozhang002 官方出一个吧,我都不会原生开发,插件不好维护

from aliyun-oss-react-native.

vinurs avatar vinurs commented on July 21, 2024

闲鱼团队不是一直在跟进flutter技术么?官方出一个应该不难啊

from aliyun-oss-react-native.

JohnnyB0Y avatar JohnnyB0Y commented on July 21, 2024

https://pub.dev/packages/aly_oss 这个是不是官方的?

from aliyun-oss-react-native.

debugksir avatar debugksir commented on July 21, 2024

@luozhang002 这么多人提需求,出个flutter sdk吧!

from aliyun-oss-react-native.

DingXuefeng avatar DingXuefeng commented on July 21, 2024

+1 求flutter版

from aliyun-oss-react-native.

saviourdog avatar saviourdog commented on July 21, 2024

+1 求flutter版

from aliyun-oss-react-native.

figureai avatar figureai commented on July 21, 2024

+1 求flutter版

from aliyun-oss-react-native.

ixugo avatar ixugo commented on July 21, 2024

+1 求flutter版

from aliyun-oss-react-native.

hello-nico-chan avatar hello-nico-chan commented on July 21, 2024

+1 求flutter版

from aliyun-oss-react-native.

Related Issues (20)

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.