d_oss 0.0.1
d_oss: ^0.0.1

Flutter Android iOS

阿里云Oss插件

d_oss #

阿里云Oss插件

Getting Started #

class OssTest { //全局初始化 static void init() { ClientConfig config = ClientConfig( endPoint: 'https://xxx.aliyuncs.com', bucket: 'yourBucket', authorizationProvider: AuthorizationProvider() ); OssClient.init(config); }

//上传 static void upload() { PutObjectRequest request = PutObjectRequest('test.jpg', '/storage/emulated/0/test.jpg'); OssClient.instance.putObject(request, onSucceed: (PutObjectResponse result) { print("upload success:${result.url}"); }, onFailed: (String msg) { print("上传失败:$msg"); }, onProgress: (int count, int total) { double progress = count * 100 / total; print("count=$count ---total=$total---progress=$progress"); }); }

//下载 static void download(){ GetObjectRequest request = GetObjectRequest('test.jpg', '/storage/emulated/0/test1112.jpg',isAuthorizationRequired: false); OssClient.instance.getObject(request, onSucceed: () { print("下载成功"); }, onFailed: (String msg) { print("下载失败"); }, onProgress: (int count, int total) { double progress = count * 100 / total; print("count=$count ---total=$total---progress=$progress"); }); }

}

class AuthorizationProvider implements AuthorizationProvider { @override Future

0
likes
55
pub points
0%
popularity

阿里云Oss插件

Homepage

Documentation

API reference

Uploader

zcys12173@gmail.com

License

Apache 2.0 (LICENSE)

Dependencies

crypto, dio, flutter

More

Packages that depend on d_oss