potions / gun_dart

A Dart wrapper around the Gun JS library.
Other
3 stars 0 forks source link

Gun Dart

Pub Version Pub Points

Gun Dart is a Dart wrapper around the Gun JS library.

This library is almost a 1:1 port of the JS library, with some minor changes to make it more Dart-like. Gun JS is a disctributed database that can be used to build decentralized applications.

Installation

Add the following to your pubspec.yaml:

dependencies:
  gun_dart: ^0.1.1

Important : Add the following to your web/index.html:

<head>
  <!-- ... -->

  <!-- import gun js -->
  <script src="https://cdn.jsdelivr.net/npm/gun/gun.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/gun/sea.min.js"></script>

  <!-- import gun js with a tested version -->
  <script src="https://cdn.jsdelivr.net/npm/gun@0.2020.1238/gun.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/gun@0.2020.1238/sea.min.js"></script>

  <!-- ... -->
</head>

Getting Started

import 'package:gun_dart/gun.dart';

void main() {
  final gun = Gun(peers: ['https://a_gun_server.com/gun']);
  final node = gun.get('node').get('subnode');

  node.on((data, key) {
    print(data);
  });

  node.put('value');
}

For more examples, see :

Authors and acknowledgment

Made by INSA Rouen Normandie students for a research project on the decentralized web. \ The project was supervised by Julien VINCKEL, CEO of Potions.

Made by:

Thanks to Gun JS for their work.