Skip to content
pubscout

sql_crdt

3.0.3, released 2 years ago by cachapa.net

Base package for Conflict-free Replicated Data Types using SQL databases

WASM-ready
$ flutter pub add sql_crdt
Source repository

What it does

Provides base functionality and abstraction for CRDTs backed by relational databases with support for Hybrid Local Clocks, query watching, and synchronization changesets.

AI-written summary of version 3.0.3, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are building a local-first application requiring offline sync capabilities using SQL
  • You need conflict-free replicated data types backed by relational databases

Skip it when

  • You need an out-of-the-box concrete implementation without using a driver package like sqlite_crdt
  • You require a traditional full-featured ORM

Strengths

  • Enables seamless synchronization across nodes via changesets
  • Includes reactive query watching capabilities
  • Uses Hybrid Local Clocks (HLC) for consistent snapshots

Weaknesses

  • Abstract base package requiring a concrete implementation like sqlite_crdt
  • Automatically modifies table schemas by adding three internal columns
  • Deleted records are only flagged and not physically removed, requiring manual GDPR sanitization

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
4

Requires a concrete driver implementation package such as sqlite_crdt or postgres_crdt.

final db = SqlCrdt();
await db.execute('CREATE TABLE users (id TEXT PRIMARY KEY, name TEXT)');
await db.execute('INSERT INTO users VALUES (?, ?)', ['1', 'Alice']);
final results = await db.query('SELECT * FROM users');

Alternatives

Packages that do the same job and could replace sql_crdt.

  • sqlite3

    If you need a direct SQLite database wrapper without CRDT logic.

  • sqflite

    If you want standard Flutter SQLite database storage without CRDT synchronization features.

  • drift

    If you want a full-featured reactive type-safe SQL database library with code generation.

Works with

Packages commonly used together with sql_crdt: ones it builds on, ones built on it, and its own family.