aws_interop 2.0.1

s3_dart #

Dart wrapper for Amazon AWS.

Some additional type information has been added to the .d.ts file on an as-needed basis.

Usage #

see the example/ directory

Generating the library #

dart_js_facade_gen lib/aws-sdk.d.ts > lib/aws_sdk.dart

Note: The committed version of this library differs from the dart_js_facade_gen output. This is necessary until is resolved.

The .min.js file #

the .min.js file has been created by running UglifyJS due to Uint8List bugs with the packaged .min.js file.

Known Issues #

Loading objects from the S3 API with newer versions, or the minified version of 2.4.13 of the JS library will not return a Uint8List in non-Dartium browsers.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Changelog #

1.0.0 #

  • Initial version


library apptreeTest;

import 'package:aws_interop/aws_sdk.dart' as aws;
import 'dart:async';
import 'dart:html';
import 'package:js/js.dart';
import 'package:jsifier/jsifier.dart';
import 'dart:convert';

Future main() async {
  var accessKey = '';
  var secretKey = '';
  var region = '';
  var bucketName = '';

  aws.config.credentials = new aws.Credentials(accessKey, secretKey);
  aws.config.region = region;

  var params = {'Bucket': bucketName, 'Key': ''};
  var options = {'params': params};
  var bucket = new aws.S3(options);
  var uploadFileBtn = querySelector('#uploadFileBtn');

  uploadFileBtn.onClick.listen((evt) async {
    var key = (querySelector('#fileName') as InputElement).value;
    var request = new aws.PutObjectRequest();
    request.Body = await getFileBody();
    request.Key = key;
    request.Bucket = bucketName;
    bucket.putObject(request, allowInterop((err, data) {
      print('error: $err');
      print('data: $data');

  var getFileButton = querySelector('#getFileBtn');
  getFileButton.onClick.listen((evt) {
    var request = new aws.GetObjectRequest();
    var key = (querySelector('#fileName') as InputElement).value;
    request.Key = key;
    request.Bucket = bucketName;
    bucket.getObject(request, allowInterop((err, data) {
      var obj = Jsifier.decode(data);
      print('content-type: ${obj["ContentType"]}');
      print('data length: ${obj["Body"]["length"]}');

  var deleteFileButton = querySelector('#deleteFileBtn');
  deleteFileButton.onClick.listen((evt) {
    var key = (querySelector('#fileName') as InputElement).value;
    var request = new aws.DeleteObjectRequest();
    request.Key = key;
    request.Bucket = bucketName;
    bucket.deleteObject(request, allowInterop((err, data) {
      if (err != null) {
        print('error deleting file: $err');
      print('deleted file $key');

Future<List<int>> getFileBody() async {
  var uploadInput = querySelector('#fileUpload');
  final files = uploadInput.files;
  if (files.length == 1) {
    final file = files[0];
    final reader = new FileReader();
    var onDone = reader.onLoadEnd.first;
    await onDone;
    var upload = reader.result.toString().split(',').elementAt(1);
    return BASE64.decode(upload);
  return null;

Use this package as a library

1. Depend on it

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

  aws_interop: ^2.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:aws_interop/aws_sdk.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0