drift_hrana
1.0.5, released 2 years ago by simonbinder.eu
Wraps hrana to connect drift to remote libsql/Turso databases
What it does
Provides a Drift-compatible database implementation that talks to a remote libsql server over WebSocket. It handles connection, authentication, and migration without requiring local SQLite.
AI-written summary of version 1.0.5, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to use drift with a remote Turso/libsql backend
- You want a single database instance shared across devices via a server
Skip it when
- You only need local storage or a different backend like SQLite or Firebase
Strengths
- Zero-copy integration with drift
- Supports migrations and transactions
- No extra code generation needed
- Cross-platform (web, mobile, desktop)
Weaknesses
- Requires running a libsql server
- Limited to libsql/Turso backends
- No offline support
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 2
Add drift_hrana to pubspec, run a libsql server (e.g., via Docker), import HranaDatabase and pass it to your Drift database constructor
import 'package:drift/drift.dart';
import 'package:drift_hrana/drift_hrana.dart';
@DriftDatabase(...)
class AppDatabase extends _$AppDatabase {
AppDatabase(super.e);
@override int get schemaVersion => 1;
}
void main() async {
final db = AppDatabase(HranaDatabase(
Uri.parse('ws://localhost:8080/'),
jwtToken: null,
));
}
Alternatives
Packages that do the same job and could replace drift_hrana.
- serverpod
Serverpod is the ultimate app-stack for agentic coding. It is a complete, open-source solution for your app, backend, website, and database, all using Flutter and Dart.
91Compare - drift_sqlite_async
Use Drift with a sqlite_async database in the same application.
80Compare - orm
Next-generation ORM for Dart & Flutter using Prisma Engine.
68Compare - drift_local_storage_inspector
Provides a SQL inspector server for drift databases via the storage_inspector package.
54Compare
Works with
Packages commonly used together with drift_hrana: ones it builds on, ones built on it, and its own family.
- driftdrift_hrana 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_sqfliteSame familyFlutter-only drift implementation using sqflite for SQLite storage.
- drift_postgresSame familyPostgres implementation and APIs for the drift database package.