locorda_drift 0.5.2 copy "locorda_drift: ^0.5.2" to clipboard
locorda_drift: ^0.5.2 copied to clipboard

SQLite storage backend for Locorda using Drift ORM. Cross-platform offline storage (iOS, Android, macOS, Windows, Linux, Web) for BYOB sync engines.

locorda_drift #

pub package license

Cross-platform SQLite storage for Locorda, implemented with Drift ORM. Stores RDF documents, triple indices, Hybrid Logical Clocks, and tombstone metadata — works on iOS, Android, macOS, Windows, Linux, and Web.

Overview #

This package provides a concrete implementation of the Storage interface from locorda_core using Drift ORM for cross-platform SQLite storage.

Features #

  • Cross-platform SQLite storage - Works on iOS, Android, Web, Windows, macOS, Linux
  • Document + Triple storage - Stores RDF as both complete documents and queryable triples
  • CRDT metadata support - Dedicated tables for Hybrid Logical Clocks and tombstones
  • Index optimization - Efficient storage for sync performance indices
  • Type-safe queries - Generated Drift APIs for compile-time safety

Database Schema #

The schema is defined as Drift table classes in lib/src/sync_database.dart. Drift generates the corresponding SQL DDL at build time.

Usage #

Main thread #

import 'package:locorda/locorda.dart';

final locorda = await initLocorda(
  storage: DriftMainHandler(
    options: LocordaDriftNativeOptions(
      databaseName: 'my_app_sync',
    ),
  ),
  remotes: [...],
  config: myLocordaConfig,
);

Worker thread #

import 'package:locorda/worker.dart';

Future<WorkerParams> createEngineParams(
  SyncEngineConfig config,
  WorkerContext context,
) async {
  return WorkerParams(
    storage: DriftWorkerHandler(
      options: LocordaDriftNativeOptions(databaseName: 'my_app_sync'),
    ),
    backends: [...],
  );
}

See the minimal example for a complete working setup.

0
likes
150
points
84
downloads

Documentation

API reference

Publisher

verified publisherlocorda.dev

Weekly Downloads

SQLite storage backend for Locorda using Drift ORM. Cross-platform offline storage (iOS, Android, macOS, Windows, Linux, Web) for BYOB sync engines.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#offline-first #crdt #storage #drift #sqlite

License

MIT (license)

Dependencies

drift, drift_flutter, flutter, locorda_core, locorda_rdf_core, locorda_rdf_jelly, locorda_worker, logging, path, path_provider, sqlite3

More

Packages that depend on locorda_drift