Skip to content
pubscout

drift_hrana

1.0.5, released 2 years ago by simonbinder.eu

Wraps hrana to connect drift to remote libsql/Turso databases

WASM-ready
$ flutter pub add drift_hrana
Source repository

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.

  • drift_sqlite_async

    Use Drift with a sqlite_async database in the same application.

  • orm

    Next-generation ORM for Dart & Flutter using Prisma Engine.

  • drift_local_storage_inspector

    Provides a SQL inspector server for drift databases via the storage_inspector package.

Works with

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