Package selection guidance compiled from public package information, community data, and project usage.
dbx is a lightweight, fast, and simple NoSQL database solution designed for Flutter applications. Built with simplicity in mind, it provides an easy-to-use interface for persistent data storage across multiple platforms. Ideal for apps needing reliable local data handling without the complexity of traditional databases, dbx supports Android, iOS, macOS, Windows, and Linux. Its minimal setup and efficient performance make it suitable for small to medium-scale data needs.
Use cases
Storing user preferences
Caching app data
Saving offline user content
Managing local state
Persisting form data
Key features
Simple API
Cross-platform support
Lightweight design
Fast read/write operations
Automatic data persistence
Suitable for
Beginner Flutter developers
Apps requiring local storage
Projects with minimal database needs
Prototyping and MVP development
Small-scale data management
Considerations
Not suitable for large datasets
Limited query capabilities
No built-in synchronization
Best for single-device use
No advanced indexing features
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
DBX
dbx is a Dart package designed for secure and efficient local storage using Protocol Buffers instead of JSON.
A Key-Value Database with Easy API that supports wide range of Data Types.
Features
Protocol Buffers: Utilizes Protocol Buffers (protobuf) for data serialization, offering significant performance improvements over JSON.
Secure Storage: Data is securely stored using flutter_secure_storage and encrypted with the encrypt library, with customizable encryption options.
Comprehensive Data Support: Supports all data types, including their list variants and JSON objects.
What we mean
Supported data types are int, double, bool, String, Uint8List, List<int>, List<double>, List<bool>, List<String>, List<Uint8List>, and Map<String, dynamic> (JSON).
Uint8List for bytes, JSON for custom objects
Efficient and Compact: Protobuf is more efficient and compact compared to JSON, with built-in data compression (gzip), reducing latency and improving app performance.
Customizable Encryption: Configure AES modes, key lengths, and IV lengths for enhanced security.
Generic Operations: Type-agnostic get/set methods for dynamic data handling.
Batch Operations: Efficient bulk read/write operations for multiple keys.
Indexing & Search: Fast key lookups, sorted keys, prefix-based searches, and existence checks.
Synchronization: Export/import functionality for data backup and cross-device sync.
Schema Versioning: Automatic migrations for schema evolution.
Utilities: Key count, file size monitoring, and bulk data removal.
Familiar Api: Same API as of SharedPreference.
Won't miss SharedPreference. No headache, easy adaption.🚀
Created With Simplicity in mind
No Object Creation, no overhead of state management solution
No Object Passing
All method are static, just call and use.
Benefits of Using Protocol Buffers Over JSON
Performance: Protobuf is significantly faster than JSON for serialization and deserialization.
Compactness: Protobuf messages are smaller in size, which reduces storage space and improves transmission speed.
Efficiency: Protobuf is more efficient in terms of CPU and memory usage.
Advantages Over Shared Preferences
Data Integrity: Protobuf ensures data integrity and consistency, which is crucial for complex data structures.
Security: Data is encrypted and securely stored, unlike shared preferences which can be more vulnerable to security breaches.
Scalability: Protobuf's efficient serialization makes it suitable for larger datasets and more complex data structures.
// Check existencebool exists = DBX.containsKey('someKey');
// Get all keysList<String> allKeys = DBX.getAllKeys();
// Get sorted keysList<String> sortedKeys = DBX.getAllKeysSorted();
// Prefix searchList<String> appKeys = DBX.getKeysStartingWith('app');
Synchronization & Backup
DBX provides export/import functionality for data backup and synchronization across devices.
Basic Backup and Restore
// Create a backupUint8List backupData = await DBX.exportData();
// Save to local file or external storageawaitFile('/path/to/backup.dbx').writeAsBytes(backupData);
// Restore from backupUint8List restoredData = awaitFile('/path/to/backup.dbx').readAsBytes();
await DBX.importData(restoredData);
Cross-Device Synchronization
For syncing data between multiple devices:
Initialize with shared key seed (same on all devices):
Conflict Resolution: Last imported data wins (no built-in merging)
Use export/import for periodic backups or when switching devices. For real-time sync, combine with cloud storage webhooks.
Note: For cross-device sync, ensure all devices use the same keySeed during initialization to maintain data compatibility.
Utilities
// Get statisticsint keyCount = DBX.keyCount;
int fileSize = await DBX.fileSize;
// Remove all data
DBX.removeAll();
// Clear and delete file
DBX.clearAll();