Skip to content
pubscout

sqlbrite

2.8.0, released 2 years ago by hoc081098.dev

Reactive stream wrapper around sqflite for Flutter.

WASM-ready
$ flutter pub add sqlbrite
Source repository

What it does

Sqlbrite wraps sqflite databases to introduce reactive stream semantics to SQL operations. Queries return streams that emit new data immediately and again whenever the underlying table is modified.

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

Use it when

  • You want reactive SQL queries in Flutter using sqflite and RxDart.
  • You need automatic query re-execution when tables are updated.

Skip it when

  • You need a full ORM or type-safe query mechanism.
  • You need automated database migrations.

Strengths

  • Integrates seamlessly with sqflite and RxDart.
  • Provides convenient extension methods like mapToOne and mapToList.
  • Allows full control of query notification frequency using RxDart operators.

Weaknesses

  • Not an ORM or a type-safe query builder.
  • Does not handle database migrations.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
4

Wrap an existing sqflite Database instance in a BriteDatabase.

final Database db = await openDb();
final briteDb = BriteDatabase(db);

final Stream<List<Entity>> listQuery$ = briteDb.createQuery(
  'table',
  where: 'name LIKE ?',
  whereArgs: [queryName],
).mapToList((row) => Entity.fromJson(row));

Alternatives

Packages that do the same job and could replace sqlbrite.

  • drift

    Drift is a reactive, type-safe SQL database for Flutter and Dart with built-in migration support and generated code.

  • hive_ce

    Hive CE is a lightweight key-value database if you do not require relational SQL features.

Works with

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