-
Notifications
You must be signed in to change notification settings - Fork 3
Database Viewer
AmisKwok edited this page Jul 21, 2026
·
2 revisions
The Database Viewer inspects SQLite databases in your app with a two-level navigation system.
数据库查看器通过双层导航系统检查应用中的 SQLite 数据库。
The inspector automatically scans the following directories for .db and .sqlite files:
检查器自动扫描以下目录中的 .db 和 .sqlite 文件:
-
getApplicationDocumentsDirectory()/ 应用文档目录 -
getDatabasesPath()/ 数据库目录
- Shows all discovered databases / 显示所有发现的数据库
- Each database shows name and table count / 每个数据库显示名称和表数量
- Global search: Search database names and table names / 全局搜索:搜索数据库名和表名
- Click a database to enter its detail view / 点击数据库进入详情视图
- Left panel: table list with row counts / 左侧面板:表列表(含行数)
- Right panel: table data in DataTable format / 右侧面板:DataTable 格式的表数据
- Back button to return to database list / 返回按钮返回数据库列表
- In-database search: Search table names AND all column data / 数据库内搜索:搜索表名和所有列数据
| Level | Search Scope |
|---|---|
| Global (database list) | Database names, table names / 数据库名、表名 |
| In-database | Table names, all column values in all tables / 表名、所有表的所有列值 |
When searching within a database, matching cell values are highlighted in accent color.
在数据库内搜索时,匹配的单元格值以强调色高亮显示。
- Color-coded table icons / 带颜色的表图标
- Row count badges for each table / 每个表的行数徽章
- Selected table highlighted / 选中表高亮
- Horizontal and vertical scrollable data table / 水平和垂直可滚动的数据表
- Row count display (filtered / total) when searching / 搜索时显示行数(过滤/总数)
Desktop platforms (Linux, macOS, Windows) require sqflite_common_ffi:
桌面平台需要 sqflite_common_ffi:
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
void main() {
sqfliteFfiInit();
databaseFactory = databaseFactoryFfi;
ZeroInspectorKit.runAppWithInspector(const MyApp());
}For non-SQLite databases, see Custom Database Provider.
对于非 SQLite 数据库,请参阅 自定义数据库提供者。