vaudb_flutter 0.1.0 copy "vaudb_flutter: ^0.1.0" to clipboard
vaudb_flutter: ^0.1.0 copied to clipboard

Flutter FFI plugin for the VauDB embedded Rust database engine.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:vaudb_flutter/vaudb_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _status = 'Tap "Run Sample"';

  Future<void> _runSample() async {
    try {
      final db = VaudbFlutter();
      db.open('example.vdb');

      try {
        db.createTable('users', ['id', 'name']);
      } catch (_) {
        // Ignore if already exists.
      }

      db.insertRow('users', ['1', 'Varish']);
      final rows = db.selectAll('users');
      db.close();

      setState(() {
        _status = 'rows=${rows.rows.length} first=${rows.rows.isNotEmpty ? rows.rows.first.values : []}';
      });
    } catch (e) {
      setState(() {
        _status = 'Error: $e';
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('VauDB Flutter Example')),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              ElevatedButton(
                onPressed: _runSample,
                child: const Text('Run Sample'),
              ),
              const SizedBox(height: 16),
              Text(_status, textAlign: TextAlign.center),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
140
points
37
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter FFI plugin for the VauDB embedded Rust database engine.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

ffi, flutter

More

Packages that depend on vaudb_flutter

Packages that implement vaudb_flutter