drift_libsql 0.0.2 copy "drift_libsql: ^0.0.2" to clipboard
drift_libsql: ^0.0.2 copied to clipboard

Turso/Libsql database client binding for Drift

drift_libsql #

Turso/Libsql database dart client for Drift

Getting Started #

Add it to your pubspec.yaml. #

drift_libsql:

Follow drift docs per usual with the addition of DriftLibsqlDatabase #

class TaskTable extends Table {
  IntColumn get id => integer().autoIncrement()();
  TextColumn get title => text()();
  TextColumn get description => text()();
  BoolColumn get completed => boolean()();
}

@DriftDatabase(tables: [TaskTable])
class AppDatabase extends _$AppDatabase {
  AppDatabase(super.e);

  @override
  int get schemaVersion => 1;
}

final db = AppDatabase(DriftLibsqlDatabase(
    "${dir.path}/replica.db",
    syncUrl: url,
    authToken: token,
    readYourWrites: true,
    syncIntervalSeconds: 3,
  ));

await db.into(db.taskTable).insert(TaskTableCompanion.insert(
	title: task.title,
	description: task.description,
	completed: task.completed));
4
likes
150
points
42
downloads

Publisher

verified publisherandikatanuwijaya.dev

Weekly Downloads

Turso/Libsql database client binding for Drift

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

drift, flutter, libsql_dart

More

Packages that depend on drift_libsql