vaudb_flutter | FarOFF V STUDIO
Flutter FFI package for the VauDB embedded Rust database engine.
Features
- Embedded offline database access via
dart:ffi - Key/value CRUD
- Transactions (
begin,commit,rollback) - Table/row CRUD
- Basic filtering (
selectWhere) - Foreign keys with
restrict/cascadeactions
Install
flutter pub add vaudb_flutter
Windows Native Library Setup
Build vaudb_engine.dll from your Rust engine project, then place it next to your app executable:
- Flutter Windows app location:
windows/runner/vaudb_engine.dll
If your Rust project has a build script (for example cargo bcopy), run that first.
Example App DLL Integration
The example Windows CMake checks these locations in order:
VAUDB_ENGINE_DLLenvironment variable (full DLL path)example/windows/runner/vaudb_engine.dll
PowerShell example:
$env:VAUDB_ENGINE_DLL='C:\path\to\vaudb_engine.dll'
flutter run -d windows
Usage
import 'package:vaudb_flutter/vaudb_flutter.dart';
final db = VauDB();
db.open('app_data.vdb');
// Create table without foreign keys.
db.createTable('users', ['id', 'name']);
// Create table with foreign keys using the same createTable method.
db.createTable(
'orders',
['id', 'user_id'],
foreignKeys: const [
ForeignKeyDefinition(
column: 'user_id',
refTable: 'users',
refColumn: 'id',
onDelete: 'cascade',
onUpdate: 'cascade',
),
],
);
db.insertRow('users', ['1', 'Varish']);
db.insertRow('orders', ['1', '1']);
final rows = db.selectAll('orders');
print(rows.rows.length);
db.close();
Notes
- Foreign key checks are enabled by default in the engine.
- Current dynamic loading is configured for Windows DLL (
vaudb_engine.dll).