oss_dart 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 47

oss_dart #

A new Flutter package project.

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

0.1.0 #

  • 添加example用例

0.0.1 #

  • 完成接口:putObject getObject initiateMultipartUpload uploadPart completeMultipartUpload listParts

example/main.dart

import '../lib/oss_dart.dart';

void main() async{
  OssClient client = OssClient(bucketName: 'bucketName',endpoint: 'endpoint',tokenGetter: getStsAccount);
  
  List<int> fileData = [];//上传文件的二进制
  
  String fileKey = 'ABC.text';//上传文件名
  var response;
  //上传文件
  response = await client.putObject(fileData, fileKey);
  //获取文件
  response = await client.getObject(fileKey);
  //分片上传
  //First get uploadId 
  String uploadId = await client.initiateMultipartUpload(fileKey);
  //Second upload part
  num partNum = 1;//上传分块的序号
  String etag = await client.uploadPart(fileData,fileKey,uploadId,partNum);
  //Third complate multiUpload
  List etags = [etag];//所有区块上传完成后返回的etag,按顺序排列
  response = await client.completeMultipartUpload(etags, fileKey, uploadId);
  //response 是阿里云返回的xml格式的数据,需要单独解析
  print(response);
 
}
//获取阿里云临时账号,具体实现参考阿里云文档
 Future<Map> getStsAccount()async{
    
    return {};
  }

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  oss_dart: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:oss_dart/oss_dart.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
86
Overall:
Weighted score of the above. [more]
47
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • oss_dart that is a package requiring null.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (intl).

The package description is too short. (-4 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
crypto ^2.1.4 2.1.5
flutter 0.0.0
http ^0.12.0+4 0.12.1
intl ^0.15.8 0.15.8 0.16.1
xml2json ^4.1.1 4.3.0
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
http_parser 3.1.4
meta 1.1.8 1.2.2
path 1.7.0
pedantic 1.9.0 1.9.2
petitparser 3.0.4
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
xml 4.2.0
Dev dependencies
flutter_test