libSQL Flutter / Dart Reference
flutter_rust_bridge
package, allowing for seamless communication between Rust and Dart.
pubspec.yaml
LibsqlClient
constructor to create the database client. Different configurations are supported, allowing connection to in-memory database, local sqlite file, remote Turso / libSQL database, or embedded replica.
LibsqlClient
:
syncUrl
:
sync()
function allows you to sync manually the local database with the remote counterpart:
syncIntervalSeconds
property when instantiating the client:
encryptionKey
:
List<Map<String, dynamic>>
. Will returns empty list when is not performing select query:
:
, @
and $
.Mode | SQLite command | Description |
---|---|---|
LibsqlTransactionBehavior.immediate | BEGIN IMMEDIATE | The transaction may execute statements that read and write data. Write transactions executed on a replica are forwarded to the primary instance, and can’t operate in parallel. |
LibsqlTransactionBehavior.readOnly | BEGIN TRANSACTION READONLY | The transaction may only execute statements that read data (select). Read transactions can occur on replicas, and can operate in parallel with other read transactions. |
LibsqlTransactionBehavior.deferred_ | BEGIN DEFERRED | The transaction starts in read mode, then changes to write as soon as a write statement is executed. This mode change may fail if there is a write transaction currently executing on the primary. |
Method | Description |
---|---|
execute() | Similar to execute() except within the context of the transaction |
query() | Similar to query() except within the context of the transaction |
commit() | Commits all write statements in the transaction |
rollback() | Rolls back the entire transaction |
ATTACH
attachment:
ATTACH
and create a token
with the permission to attach a database — learn
more