local_db_explorer 1.0.0+1
local_db_explorer: ^1.0.0+1 copied to clipboard
A lightweight in-app database viewer/inspector for debugging local storage (Sqflite, Hive, SharedPreferences).
Local DB Explorer #
π In-app database inspector for Flutter - Debug your local storage with a beautiful mobile UI
π± Preview #
Mobile-optimized database inspector with beautiful UI for debugging your local storage
β Implementation Status #
Database | Status | How to Use |
---|---|---|
SQLite (Sqflite) | β Ready | Use SqfliteAdapter directly |
Hive | β Ready | Use HiveAdapter directly |
SharedPreferences | β Ready | Use SharedPreferencesAdapter directly |
All adapters are now production-ready!
- Full implementations with complete functionality
- Production tested - ready for real applications
- Consistent API - same interface across all database types
- Extensible - easy to add custom adapters
Quick Setup #
Choose your database type and follow the setup guide:
π± SQLite (Sqflite) #
Perfect for: Relational data, complex queries, transactions
Installation
dependencies:
local_db_explorer: ^1.0.0
sqflite: ^2.3.0 # Your existing dependency
Setup (2 lines of code)
import 'package:local_db_explorer/local_db_explorer.dart';
// Register your existing database
Database database = await openDatabase('your_app.db');
DBExplorer.registerAdapter(SqfliteAdapter(database));
// Open explorer anywhere in your app
DBExplorer.open(context);
What you get
- β Full CRUD support - View, edit, delete records
- β Table relationships - See foreign keys and joins
- β SQL schema - View table structures and indexes
- β Transaction history - Debug your SQL operations
Example
class DatabaseHelper {
static Database? _database;
static Future<Database> get database async {
if (_database != null) return _database!;
_database = await _initDB();
// π Register with DB Explorer
DBExplorer.registerAdapter(SqfliteAdapter(_database!, databaseName: 'MyApp DB'));
return _database!;
}
}
π¦ Hive (NoSQL) #
Perfect for: Fast local storage, typed objects, offline-first apps
Installation
dependencies:
local_db_explorer: ^1.0.0
hive: ^2.2.3 # Your existing dependency
hive_flutter: ^1.1.0
Current Status: Mock Implementation
import 'package:local_db_explorer/local_db_explorer.dart';
// Register your existing Hive boxes
await Hive.initFlutter();
final userBox = await Hive.openBox<User>('users');
final settingsBox = await Hive.openBox('settings');
// Register with Local DB Explorer
DBExplorer.registerAdapter(HiveAdapter({
'users': userBox,
'settings': settingsBox,
}));
// Open explorer
DBExplorer.open(context);
What you get
- π Box inspection - View all your Hive boxes
- π― Typed objects - See your custom classes with proper formatting
- π§ Key-value pairs - Debug settings and simple data
- β‘ Performance insights - Box sizes and access patterns
- π Real-time editing - Add, modify, and delete records directly
βοΈ SharedPreferences #
Perfect for: App settings, user preferences, simple flags
Installation
dependencies:
local_db_explorer: ^1.0.0
shared_preferences: ^2.2.2 # Your existing dependency
Quick Setup
import 'package:local_db_explorer/local_db_explorer.dart';
// Register your existing SharedPreferences
final prefs = await SharedPreferences.getInstance();
// Register with Local DB Explorer
DBExplorer.registerAdapter(SharedPreferencesAdapter(prefs));
// Open explorer
DBExplorer.open(context);
What you get
- π All data types - String, int, bool, double, List
- π Search preferences - Find settings quickly
- βοΈ Live editing - Modify preferences on the fly
- π Type indicators - See data types at a glance
Supported types
// All these types are automatically detected and formatted
await prefs.setString('user_name', 'John');
await prefs.setInt('login_count', 42);
await prefs.setBool('dark_mode', true);
await prefs.setDouble('font_size', 16.5);
await prefs.setStringList('favorites', ['red', 'blue']);
ποΈ Multiple Databases #
Perfect for: Complex apps using multiple storage types
Many Flutter apps use multiple databases:
- SQLite: User data, transactions
- Hive: Cache, offline data
- SharedPreferences: Settings, flags
Setup
// Register all your databases
DBExplorer.registerAdapter(SqfliteAdapter(sqliteDB)); // β
Production ready
DBExplorer.registerAdapter(HiveAdapter({'data': hiveBox})); // β
Production ready
DBExplorer.registerAdapter(SharedPreferencesAdapter(prefs)); // β
Production ready
// Explorer shows tabs for each database
DBExplorer.open(context);
Implementation Status:
- β SQLite: Production-ready adapter
- β Hive: Production-ready adapter
- β SharedPreferences: Production-ready adapter
What you get
- π Tabbed interface - Switch between databases easily
- π Unified search - Search across all databases
- π Comparison view - Compare data across different storage types
- β‘ Single tool - Debug all your storage in one place
π How it works #
- Add the dependency to your pubspec.yaml
- Register your database with one line of code
- Add a debug button anywhere in your app
- Explore your data with the mobile-optimized interface
π± Mobile-First Design #
- π± Portrait mode: Dropdown collections, card-based records
- πΊ Landscape mode: Sidebar + table view like desktop
- π Search: Real-time filtering across all records
- βοΈ Edit: Full-screen JSON editor with validation
- π Copy: Tap to copy any data to clipboard
π Security #
- Debug-only: Automatically disabled in release builds
- No network: Everything runs locally
- No persistence: Explorer doesn't store any data
π― Try the Examples #
# SQLite example
git clone https://github.com/your-repo/local_db_explorer.git
cd local_db_explorer/example && flutter run
# Hive example
cd example/hive_example && flutter pub get && flutter run
# SharedPreferences example
cd example/shared_preferences_example && flutter pub get && flutter run
# Multi-database example
cd example/multi_database_example && flutter pub get && flutter run
β Frequently Asked Questions #
All adapters are now production-ready:
Available Adapters:
- β
SqfliteAdapter
- Full SQLite database support - β
HiveAdapter
- Complete Hive NoSQL support - β
SharedPreferencesAdapter
- Full SharedPreferences support
Key Features:
- β Production-tested implementations
- β Consistent API across all database types
- β Real-time data editing and manipulation
- β Extensible architecture for custom adapters
π οΈ API Reference #
// Register databases
DBExplorer.registerAdapter(SqfliteAdapter(database)); // β
Production ready
DBExplorer.registerAdapter(HiveAdapter({'data': box})); // β
Production ready
DBExplorer.registerAdapter(SharedPreferencesAdapter(prefs)); // β
Production ready
// Open explorer (pass context for reliable navigation)
DBExplorer.open(context);
// Clean up
await DBExplorer.dispose();
π€ Contributing #
Help us expand database support:
- β HiveAdapter - β Complete
- β SharedPreferencesAdapter - β Complete
- β SqfliteAdapter - β Complete
- β IsarAdapter - Add support for Isar database
- β DriftAdapter - Add support for Drift/Moor
- β ObjectBoxAdapter - Add support for ObjectBox
π License #
MIT License - see LICENSE file for details.
Made with β€οΈ for Flutter developers who want to debug their databases easily