/dart-ipfs

Dart IPFS SDK

Primary LanguageDartApache License 2.0Apache-2.0

Dart IPFS SDK

License

The IPFS Dart SDK is the unofficial SDK for integrating with an IPFS instance.

1. Depend on it

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

dependencies:
  ipfs_sdk: 0.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:

import 'package:ipfs_sdk/client.dart';

A simple usage example:

import 'dart:io';

import 'package:ipfs_sdk/client.dart';

void main() async {
  const uri = 'http://localhost:5001';
  const text = 'ProximaX is a next-generation blockchain protocol.';
  var client = IpfsClient.fromUri(uri);

  // upload
  var resp = await client.addString(text);
  print('uploaded content with hash ${resp.hash}');

  // download
  var downloaded = await client.catString(resp.hash);
  print('downloaded content is "$downloaded".');

  exit(0);
}

Wiki and Examples

Examples are in the examples folder

For more examples, go to our wiki

Contribution

Please feel free to raise any issues or PR and we'll review your contribution.

Please file feature requests and bugs at the issue tracker.