Skip to main content

passnote 1.1.2 copy "passnote: ^1.1.2" to clipboard
passnote: ^1.1.2 copied to clipboard

End-to-end encrypted, server-less, local-first CRDT sync engine for Dart: typed collections, queries, SQLite storage, device identity, sync protocol.

example/passnote_example.dart

// Two stores converge by exchanging changesets: the merge is idempotent and
// order-independent, which is the property everything else builds on. A real
// app opens collections through `passnoteBuilder` (package:passnote_flutter)
// or `Passnote.builder`; a real deployment stores in `SqliteCrdtTable` and
// syncs over a transport.
import 'package:passnote/engine.dart';

Future<void> main() async {
  final alice = MapCrdtTable('todos');
  final bob = MapCrdtTable('todos');

  await alice.put('todos', 'milk', {'title': 'Milk', 'done': false});
  await bob.put('todos', 'bread', {'title': 'Bread', 'done': true});

  await bob.merge(await alice.changeset('todos'));
  await alice.merge(await bob.changeset('todos'));

  print(await alice.value('todos', 'bread')); // {title: Bread, done: true}
  print(await bob.value('todos', 'milk')); // {title: Milk, done: false}
}
0
likes
160
points
239
downloads
screenshot

Documentation

API reference

Publisher

verified publishernodsoftware.net

Weekly Downloads

End-to-end encrypted, server-less, local-first CRDT sync engine for Dart: typed collections, queries, SQLite storage, device identity, sync protocol.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

crdt, crypto, cryptography, meta, sqlite3

More

Packages that depend on passnote