drift_sqflite
2.0.1, released 3 years ago by simonbinder.eu
Flutter-only drift implementation using sqflite for SQLite storage.
Quiet but busy
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.
Works with
Packages commonly used together with drift_sqflite: ones it builds on, ones built on it, and its own family.
- sqflitedrift_sqflite depends on itSQLite plugin for Flutter supporting iOS, Android and MacOS.
- driftdrift_sqflite depends on itDrift is a reactive library to store relational data in Dart and Flutter applications.
- drift_devSame familyGenerates Dart database code from Drift table definitions as a dev‑dependency.
- drift_flutterSame familyProvides a simple Flutter‑specific helper to open drift databases on all platforms.
- drift_postgresSame familyPostgres implementation and APIs for the drift database package.
- drift_hranaSame familyWraps hrana to connect drift to remote libsql/Turso databases