dorm_sqlite_database 2.0.0-dev.5
dorm_sqlite_database: ^2.0.0-dev.5 copied to clipboard
A SQLite database engine for dORM applications that need local, persistent relational data with typed queries and transactions.
dorm_sqlite_database example #
dorm_sqlite_database connects dORM repositories to a local SQLite database through the asynchronous sqlite_async API.
Native Dart and Flutter #
Add dorm_framework, dorm_sqlite_database, and sqlite_async to an application. Create the database, pass it to the generated Dorm facade, and close it when the application shuts down:
import 'package:dorm_sqlite_database/dorm_sqlite_database.dart';
import 'package:sqlite_async/sqlite_async.dart';
final database = SqliteDatabase(path: 'app.db');
final engine = Engine(database);
final dorm = Dorm(engine);
Dorm is generated by dorm_generator; it is application code and is not exported by this backend package. The application owns the schema and migrations.
Web and WASM #
Web applications require the sqlite3.wasm asset and the worker setup documented by sqlite_async. Configure those assets in the application before creating SqliteDatabase.
Complete showcase #
dart pub global activate dorm_example
dorm_example --engine sqlite
cd sqlite
dart pub get
dart run build_runner build
The generated project demonstrates the SQLite engine with generated models, repositories, filters, relationships, streams, and transactions.