flutter_db_inspector library

Flutter DB Inspector: inspect your app's local databases from DevTools, VS Code and Android Studio while it runs.

This library is the runtime (DbInspector, the adapter contract and the generic document and key-value engines) plus the wire protocol. Add one connector package per storage the app uses:

import 'package:flutter_db_inspector/flutter_db_inspector.dart';
import 'package:flutter_db_inspector_sqlite/flutter_db_inspector_sqlite.dart';

DbInspector.initialize(
  enabled: kDebugMode,
  databases: [
    InspectorDatabase(name: 'app_database', adapter: SqliteAdapter(db)),
  ],
);

Tools that only speak the protocol can import package:flutter_db_inspector/protocol.dart instead.

Classes

AdapterErrors
Helpers shared by adapter implementations.
ColumnInfo
DatabaseDescriptor
A registered database as seen by clients.
DatabaseMetadata
Engine metadata for database.info.
DatabaseStats
Result of database.stats.
DbAdapter
Contract every database engine implements.
DbInspector
Public entry point of Flutter DB Inspector.
DbRegistry
Holds the databases exposed to clients.
DbValueCodec
Encodes raw Dart values into protocol JSON values and back.
DocumentAdapter
Generic adapter for object/document engines.
DocumentCollection
A collection of objects/documents (an Isar collection, an ObjectBox box, a Realm class, a Sembast store, ...) that DocumentAdapter can inspect.
DocumentPage
Result of a native DocumentCollection.query.
EntitySummary
A table/view/collection listed by schema.list.
ErrorCodes
Standard error codes. Clients must tolerate codes they do not know.
ForeignKeyInfo
IndexInfo
InMemoryQuery
Value helpers for engines that filter, sort and search in memory (key/value and document stores without a native query engine).
InspectorConfig
Immutable runtime configuration.
InspectorDatabase
A database to expose, for DbInspector.initialize's databases list.
InspectorError
A structured protocol error. Raw exceptions are never sent over the wire.
InspectorEvents
Events posted on the VM service Extension stream.
InspectorFailure
InspectorLimits
Safety limits protecting the running application.
InspectorRequest
A protocol request.
InspectorResponse
A protocol response: either InspectorSuccess or InspectorFailure.
InspectorRouter
Routes protocol requests to adapters.
InspectorStatus
Result of inspector.status.
InspectorSuccess
KeyValueAdapter
Generic adapter for key/value engines (Hive boxes, SharedPreferences, secure storage).
KeyValueStore
A named key/value collection (a Hive box, SharedPreferences, secure storage, ...) that KeyValueAdapter can inspect.
MaskedValue
Sentinel the runtime substitutes for sensitive values.
Methods
Protocol method names.
MutationResult
RegisteredDatabase
A database registered with the inspector.
ResultColumn
A column in a result set.
RowFilter
RowRecord
One row: raw values in column order plus the key used for edits.
RowSort
RowsPage
Result of rows.query.
RowsQuery
Parameters of rows.query (and, without paging, rows.count).
SchemaOverview
Result of schema.list.
SqlRequest
Parameters of query.execute.
SqlResult
Result of query.execute.
TableSchema
Result of schema.table.
TriggerInfo
TruncatedValue
A value an adapter could only partially read (e.g. a large text or blob column). preview is a String or Uint8List; totalBytes is the size of the full value.
ValueChunk
A slice of a large value. Text is returned as UTF-8 bytes so slices can be concatenated byte-exactly by the client.
ValueEncodingOptions
Limits applied when encoding values for a response.
ValueRef
Addresses one value for chunked reads (value.read).

Enums

DbCapability
Operations a database adapter may support. Clients hide everything an adapter does not advertise.
DbDataModel
How an engine organises data. Clients use it for terminology and layout (Tables/Rows vs Collections/Objects vs Boxes/Entries); behaviour is driven by DbCapability, never by the engine name.
DbValueType
Normalized value types so every engine renders through the same UI.
EntityKind
Kinds of browsable entities. Non-SQL engines use collection, box or store instead of being forced into a table model.
FilterOperator
InspectorMode
Inspector modes. disabled never registers the service extension.
RowKeyKind
How rows of an entity are identified for edits.
SortDirection
SqlStatementKind

Constants

packageVersion → const String
Version of this runtime package, reported by inspector.status.
protocolVersion → const int
Protocol version spoken by this package.
serviceExtensionName → const String
The single VM service extension through which every request flows.
serviceExtensionRequestParam → const String
Name of the service extension parameter carrying the JSON request.
supportedProtocolVersions → const List<int>
Every protocol major version this package can still answer.

Functions

decodeKey(JsonMap json) → RowKey
decodeValues(JsonMap json) → RowKey
encodeKey(RowKey key) → RowKey

Typedefs

JsonMap = Map<String, Object?>
A decoded JSON object.
RowKey = Map<String, Object?>
Raw (decoded) column → value map identifying one row, e.g. {"rowid": 42} or {"tenant": "a", "id": 7}.

Exceptions / Errors

InspectorException
Thrown inside the runtime and adapters; converted to an error response by the router.