sqflite_db_inspector 0.1.5 copy "sqflite_db_inspector: ^0.1.5" to clipboard
sqflite_db_inspector: ^0.1.5 copied to clipboard

Flutter DevTools extension and VM service hook to browse sqflite databases in any Flutter app (tables, schema, row preview, live refresh).

sqflite_db_inspector #

Flutter DevTools extension plus a VM service hook to inspect sqflite in any Flutter app: browse tables, column metadata, row preview, filters, and CRUD (debug/profile only).

Required: register the VM hook in your app #

The DevTools UI does nothing until your running app calls registerSqliteInspector. That registers the VM service extension DevTools talks to.

You should:

  1. Add sqflite_db_inspector to dependencies (see below).
  2. After WidgetsFlutterBinding.ensureInitialized(), call registerSqliteInspector once per process (wrapped in !kReleaseMode is recommended). Pass a callback that returns the Future<Database> your app actually uses for sqflite—not a second connection unless intentional.
  3. If the project has multiple entrypoints (e.g. main_development.dart, main_staging.dart) that do not share the same bootstrap code path, register in each path that can run under DevTools. Otherwise that flavor will show errors like the extension not being registered or no data.

Release builds: registerSqliteInspector returns immediately in release (kReleaseMode); no DevTools traffic in production.

See also the dartdoc on registerSqliteInspector in the package API (IDE hover).

On pub.dev, the Example tab shows the example/ app (same code as in the published tarball).

Add to your app #

dependencies:
  sqflite_db_inspector: ^0.1.5

Registration snippet #

After WidgetsFlutterBinding.ensureInitialized():

import 'package:flutter/foundation.dart';
import 'package:sqflite_db_inspector/sqflite_db_inspector.dart';

if (!kReleaseMode) {
  registerSqliteInspector(() => yourOpenDatabase());
}

Replace yourOpenDatabase with your real opener (e.g. () => LocalDatabase.instance.database). It must return the same Future<Database> the rest of the app uses.

DevTools #

Enable the extension (optional devtools_options.yaml):

extensions:
  - sqflite_db_inspector: true

License #

BSD-3-Clause — LICENSE.

1
likes
160
points
42
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter DevTools extension and VM service hook to browse sqflite databases in any Flutter app (tables, schema, row preview, live refresh).

Homepage
Repository (GitHub)
View/report issues

Topics

#devtools #sqflite #database #debugging

License

BSD-3-Clause (license)

Dependencies

flutter, sqflite

More

Packages that depend on sqflite_db_inspector