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.

  • Web support only.
  • Null safety.
  • SEA encryption.

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 :

  • the example/example.dart demo file.
  • the example/ a flutter demo project.

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:

  • Julie ALLAIS
  • Paul BRIDIER
  • Louis DEVAUD
  • Louis DISPA
  • Damien GENS
  • Sarah LE MÉE

Thanks to Gun JS for their work.

Libraries

gun
types