सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
dbx एक हल्का, तेज़ और सरल NoSQL डेटाबेस समाधान है जो Flutter एप्लिकेशन के लिए डिज़ाइन किया गया है। सरलता के मुख्य बिंदु पर बनाया गया, यह विभिन्न प्लेटफॉर्मों पर स्थायी डेटा स्टोरेज के लिए आसान उपयोग वाला इंटरफेस प्रदान करता है। पारंपरिक डेटाबेस की जटिलता के बिना विश्वसनीय स्थानीय डेटा हैंडलिंग की आवश्यकता वाले एप्लिकेशन के लिए आदर्श, dbx Android, iOS, macOS, Windows और Linux का समर्थन करता है। इसकी न्यूनतम सेटअप और कुशल प्रदर्शन छोटे से मध्यम आकार की डेटा आवश्यकताओं के लिए उपयुक्त है।
उपयोग
उपयोगकर्ता पसंदीदा संग्रहित करना
एप्लिकेशन डेटा को कैश करना
ऑफलाइन उपयोगकर्ता सामग्री को सहेजें
स्थानीय राज्य का प्रबंधन
फॉर्म डेटा को संरक्षित करना
मुख्य विशेषताएँ
सरल API
क्रॉस-प्लेटफ़ॉर्म समर्थन
हल्का डिज़ाइन
त्वरित पढ़ने/लिखने की संचालन
स्वचालित डेटा स्थायित्व
इनके लिए उपयुक्त
शुरुआती Flutter विकासकर्ता
स्थानीय भंडारण की आवश्यकता वाले ऐप्स
न्यूनतम डेटाबेस की आवश्यकता वाले प्रोजेक्ट
प्रोटोटाइपिंग और एमवीपी विकास
छोटे पैमाने का डेटा प्रबंधन
विचार योग्य बातें
बड़े डेटासेट के लिए उपयुक्त नहीं
सीमित प्रश्न क्षमता
कोई बिल्ट-इन सिंक्रनाइजेशन नहीं
एक उपकरण के उपयोग के लिए सबसे अच्छा
कोई उन्नत इंडेक्सिंग विशेषताएँ नहीं
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
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();