skynet 1.0.0 copy "skynet: ^1.0.0" to clipboard
skynet: ^1.0.0 copied to clipboard

outdated

Use Sia Skynet and SkyDB in your Dart and Flutter projects.

Skynet SDK for Dart #

Use Sia Skynet and SkyDB in your Dart and Flutter projects.

This package allows you to use the decentralized SkyDB (https://blog.sia.tech/skydb-a-mutable-database-for-the-decentralized-web-7170beeaa985) and upload files to Skynet.

Install #

dependencies:
  skynet: ^1.0.0

Usage #

import 'dart:convert';
import 'package:skynet/skynet.dart';

void main() async {
  SkynetConfig.host = 'siasky.net';

  final user = User('username', 'password');

  print(user.id); // Public User ID

  final fileID = FileID(
    applicationID: 'note-to-self', // ID of your application
    fileType: FileType.PublicUnencrypted,
    filename: 'note.txt', // Filename of the data you want to store
  );

  final currentFile = await getFile(user, fileID);
  print(currentFile.asString);

  final res = await setFile(
    user,
    fileID,
    SkyFile(
      content: utf8.encode('Hello, world!'), // The content you want to store
      filename: fileID.filename,
      type: 'text/plain', // Content type (Other examples: application/json or image/png)
    ),
  );
  print(res);

  final updatedFile = await getFile(user, fileID);
  print(updatedFile.asString);
}
6
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Use Sia Skynet and SkyDB in your Dart and Flutter projects.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

convert, crypto, cryptography, fixnum, hex, http, http_parser, password_hash

More

Packages that depend on skynet