d_rocket_engine_web 2.0.0
d_rocket_engine_web: ^2.0.0 copied to clipboard
Web engine for d_rocket 2.0: IndexedDB-backed DbContext via package:idb_shim. Pure Dart, no WASM, no native binding.
d_rocket_engine_web #
Web engine for the d_rocket 2.0
framework. Provides a DbContext backed by the browser's
IndexedDB via the pure-Dart
idb_shim wrapper.
No Rust, no WASM, no native binding — works in any browser that supports IndexedDB (every browser since IE 10 / iOS 8 / Chrome 24).
Install #
dependencies:
d_rocket: ^2.0.0
d_rocket_engine_web: ^2.0.0
Quick start #
import 'package:d_rocket/d_rocket.dart';
import 'package:d_rocket_engine_web/d_rocket_engine_web.dart';
void main() async {
// Register the web engine once at app boot.
dRocketWeb();
// Open an IndexedDB-backed database.
final db = await WebDb.open(name: 'my-app-db');
// ...
}
Note:
WebDbis the web engine's concrete Db implementation, exposed byd_rocket_engine_web. It is API-compatible withDbfor the engine-agnostic subset (WebDb.open,WebDb.set<T>(), etc.).
Engines #
d_rocket is engine-agnostic. The runtime core (d_rocket)
ships no driver code; you pick one engine per platform:
| Engine | Backend | Platform |
|---|---|---|
d_rocket_engine_sqlite |
package:sqlite3 |
iOS, Android, macOS, Linux, Windows |
d_rocket_engine_postgres |
package:postgres |
Server, native |
d_rocket_engine_web |
IndexedDB (via idb_shim) |
Web (browser, Flutter web) |
Limitations #
- The package is a thin wrapper around
idb_shim. Allidb_shimlimitations apply (noLIKE/ regex on the DB side; no full-text search; transactions are per-tab). - Browser-tab isolation: each tab has its own database
connection. Cross-tab live queries are NOT supported
(use
BroadcastChannelor a websocket layer for that). - The
LIKEoperator is implemented in Dart (not in IndexedDB), sowhere_(o => o.name.like_('%al%'))is slower than awhere_(o => o.name == 'alice').
Tests #
74 tests across 7 files. 5 are conditional skips because
the in-memory shim doesn't honor openCursor exactly like
the browser does; the real browser path is verified by
flutter test --platform chrome.
# VM-side (in-memory shim):
dart test
# Browser-side:
flutter test --platform chrome
License #
MIT — see LICENSE. Copyright (c) 2026 Torogoz Tech.
Author #
Abner Velasco — Arquitecto de Soluciones