Search packages, repositories and app categories

Package detailsv0.0.3

flutter_gundb

A gunDB port P2P encrypted Communication between multiple users.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
35
Likes
14
Pub points
120

Install package

flutter pub add flutter_gundb

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

flutter_gundb is a Flutter package that brings GunDB's peer-to-peer, encrypted communication capabilities to Flutter applications. It enables real-time data synchronization across multiple users without relying on a central server, ensuring privacy and low latency. Built on top of GunDB’s decentralized architecture, it supports secure, offline-first data sharing across Android, iOS, Web, macOS, Windows, and Linux. The package simplifies integration with existing Flutter projects through a straightforward API for data storage, retrieval, and synchronization.

Use cases

  • Real-time collaborative apps
  • Decentralized messaging platforms
  • Offline-first data sync
  • Peer-to-peer file sharing
  • Secure IoT device communication
  • Distributed task management

Key features

  • End-to-end encryption
  • Cross-platform support
  • Offline-first functionality
  • P2P data synchronization
  • Lightweight and fast
  • Automatic conflict resolution

Suitable for

  • Developers building decentralized apps
  • Teams needing secure real-time collaboration
  • Projects requiring minimal server dependency
  • Apps targeting multiple platforms
  • Users prioritizing data privacy

Considerations

  • Requires careful handling of encryption keys
  • Network discovery may vary by platform
  • Performance depends on network conditions
  • Limited documentation compared to mainstream solutions
  • Not suitable for high-throughput centralized systems

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Flutter GunDB

This library is a port of GunDB js for the Dart and Flutter. P2P encrypted Communication between multiple users. GUN is an ecosystem of tools that let you build community run and encrypted applications - like an Open Source Firebase or a Decentralized Dropbox.

Note: Some APIs like certify and user, not implemented completely (Trying to do so ;) )

Demo

Demo Gif

Features

  1. Multiplayer by default with realtime p2p state synchronization!
  2. Graph data lets you use key/value, tables, documents, videos, & more!
  3. Local-first, offline, and decentralized with end-to-end encryption.

Decentralized alternatives to Zoom, Reddit, Instagram, Slack, YouTube, Stripe, Wikipedia, Facebook Horizon and more have already pushed terabytes of daily P2P traffic on GUN.

Getting started

Add library to your app.

flutter pub add flutter_gundb

or

.....
dependencies:
  flutter_gundb: ^0.0.3
....

Usage

Short example is below. Added longer examples to /example folder.

import 'package:flutter_gundb/flutter_gundb.dart';

void main() {
    final chainGunClient = FlutterGunSeaClient();
    
    final getAditya = gun.get('aditya');
    getAditya.put({
      name: "Aditya Kumar Pandey",
      email: "janatig@janatig.com",
    });
    getAditya.on((a, [b, c]) {
      print('Getting Value:: $a');
    });
}

Example on how to store the data locally.

import 'package:flutter_gundb/flutter_gundb.dart';

void main() async {
    await initializeFlutterGun();
    final chainGunClient = FlutterGunSeaClient(registerStorage: true);
    
    final localFirstStorage = gun.get('local-first-storage');
    localFirstStorage.put({
      name: "Testing the Local First",
      anime_website: "animeloved.com",
    });
    localFirstStorage.on((a, [b, c]) {
      print('Getting Value:: $a');
    });
}

Example How to send other user encrypted data

import 'package:flutter_gundb/flutter_gundb.dart';

void main() {   
    () async {
      var aditya = await pair();
      var pandey = await pair();

      // On Aditya
      var shared = await secret(pandey.epub, aditya);
      var shared_enc = await encrypt('<Your Shared Data>', shared);
      
      // Now Share `shared_enc` to your friend pandey (Send shared_enc and aditya's public key)
      
      // On Pandey Side

      var decryptKey = await secret(aditya.epub, pandey);
      var decryptedData = await decrypt(shared_enc, decryptKey);
      
      // `decryptedData` This is your Decrypted Data
    } ();
}

Additional information

Some APIs like certify and user. If anyone wants to help, kindly send a PR. I would appreciate it. Thank you in advance :)

Categories

Dependencies

Dependency list 8 items

Source repository

Projects using this package

No data available yet.