Skip to content
pubscout

drift_sqflite

2.0.1, released 3 years ago by simonbinder.eu

Flutter-only drift implementation using sqflite for SQLite storage.

Quiet but busy
$ flutter pub add drift_sqflite
Source repository

What it does

Provides a Drift database backend that runs on top of the sqflite plugin. It lets you write Drift tables and queries while storing data via sqflite’s file‑based SQLite. Ideal for projects that already use sqflite or are migrating from moor_flutter.

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

Use it when

  • Migrating an existing moor_flutter project to Drift
  • You want a pure‑Flutter SQLite solution without native sqlite3 libs
  • You already depend on sqflite and prefer to keep a single storage plugin

Skip it when

  • Targeting web or desktop platforms where sqflite isn’t supported
  • Needing the highest possible SQLite performance provided by native libraries
  • You prefer a zero‑code‑gen approach

Strengths

  • Easy migration from moor_flutter
  • No need for sqlite3_flutter_libs or other native binaries
  • Works with existing sqflite infrastructure

Weaknesses

  • Only supports Flutter platforms (android, ios, macos)
  • Relies on sqflite which can be slower than native sqlite3
  • Does not support code‑generation‑free usage

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
3
import 'package:drift/drift.dart';
import 'package:drift_sqflite/drift_sqflite.dart';

@DriftDatabase(tables: [Todos, Categories])
class MyDatabase extends _$MyDatabase {
  MyDatabase() : super(_openConnection());
  @override
  int get schemaVersion => 1;
}

QueryExecutor _openConnection() {
  return SqfliteQueryExecutor.inDatabaseFolder(path: 'db.sqlite');
}

Alternatives

Packages that do the same job and could replace drift_sqflite.

  • sqlite3

    Provides native SQLite bindings for higher performance

Works with

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