dbinspect_bridge 0.1.0
dbinspect_bridge: ^0.1.0 copied to clipboard
Inspect the embedded databases inside your running Dart or Flutter application from a desktop client, over a paired, loopback-by-default connection.
dbinspect_bridge #
Inspect the embedded databases inside your running Dart or Flutter application from a desktop client, over a paired, loopback-by-default connection.
This package is the bridge core: the wire protocol, pairing, the WebSocket transport, and the release-build guard. It is engine-neutral — it knows nothing about any particular database. Adapters live in their own packages, so using one never drags in the dependencies of the others:
| Package | Databases |
|---|---|
dbinspect_sqflite |
sqflite / SQLite |
dbinspect_drift |
Drift |
dbinspect_hive |
Hive |
nitrite_bridge |
Nitrite |
Use #
import 'package:dbinspect_bridge/dbinspect_bridge.dart';
import 'package:dbinspect_sqflite/dbinspect_sqflite.dart';
await startBridge(
appName: 'example_app',
adapters: [
SqfliteAdapter(executor: db, id: 'app', displayName: 'app.db'),
],
);
The pairing code is printed to your logger in a banner. Type it into the client to connect.
What it will not do without being asked #
It is not in your release build. startBridge returns null behind a
compile-time constant, so the AOT compiler drops the server and the protocol
strings entirely. To inspect a release build of your own app on purpose, opt in
with --dart-define=DBINSPECT_BRIDGE=true.
It binds 127.0.0.1. Reaching it from another machine is meant to be a
deliberate act — adb forward tcp:9000 tcp:9000 or an SSH tunnel. If you do set
bindAddress, the connection is TLS and a certificate is generated for the
session; its SHA-256 fingerprint goes in the banner for the client to pin.
Everything beyond reading is off. edit, sql and snapshot are false
and regex is absent unless you opt in per adapter. An operation that is off is
absent from the reported capabilities, not merely refused when called.
Pairing is not a formality. The code is 40 bits, regenerated per run, compared in constant time, and the failure budget is per bridge session rather than per connection — ten wrong guesses close pairing until the application restarts.
Licence #
Apache-2.0.