drift_libsql

Creator: coderz1093

Last updated:

0 purchases

drift_libsql Image
drift_libsql Images

Languages

Categories

Add to Cart

Description:

drift libsql

drift_libsql #
Turso/Libsql database dart client for Drift
Getting Started #
Add it to your pubspec.yaml. #
drift_libsql:
copied to clipboard
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));
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.