Couchbase Lite Community Edition के लिए Flutter प्लगइन, एक एम्बेडेड हल्का, नॉ-SQL डेटाबेस जो Android और iOS पर लाइव सिंक्रनाइज़ेशन और ऑफलाइन सपोर्ट के साथ आता है।
सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
Couchbase Lite एक हल्का, एम्बेडेड NoSQL डेटाबेस है जो Flutter ऐप्स के लिए है, जो ऑफलाइन डेटा स्टोरेज और डिवाइस के बीच रियल-टाइम सिंक्रनाइजेशन की अनुमति देता है। मोबाइल प्लेटफॉर्म के लिए डिज़ाइन किया गया, यह Android और iOS का समर्थन करता है और Couchbase Sync Gateway के माध्यम से निरंतर सिंक्रनाइजेशन क्षमता प्रदान करता है। प्लगइन Couchbase Lite Community Edition को Flutter प्रोजेक्ट में एकीकृत करता है, जिससे विकासकर्ता स्थानीय रूप से संरचित डेटा स्टोर कर सकते हैं और जब जुड़ाव पुनः स्थापित होता है तो बदलावों को सिंक कर सकते हैं। विश्वसनीय ऑफलाइन कार्यक्षमता और डिवाइस के बीच सुसंगत डेटा की आवश्यकता वाले ऐप्स के लिए आदर्श है।
उपयोग
ऑफलाइन-प्रथम मोबाइल एप्लिकेशन्स
रियल-टाइम डेटा सिंक्रनाइज़ेशन
मोबाइल ऐप में स्थानीय डेटा परिपक्वता
स्थानीय डेटाबेस की आवश्यकता वाले हाइब्रिड एप्प्स
क्रॉस-डिवाइस डेटा सुसंगतता
मुख्य विशेषताएँ
एम्बेडेड नोएसक्यूएल डेटाबेस
Sync Gateway के साथ लाइव सिंक्रनाइजेशन
टिकाऊ ऑफलाइन समर्थन
क्रॉस-प्लेटफॉर्म (Android और iOS)
हल्का और तेज प्रदर्शन
इनके लिए उपयुक्त
ऑफलाइन डेटा की आवश्यकता वाले मोबाइल ऐप विकासकर्ता
वास्तविक समय सिंक की आवश्यकता वाले ऐप्स
ऑफलाइन क्षमता वाले फीचर्स बनाने वाली स्टार्टअप्स
NoSQL डेटा मॉडल का उपयोग करने वाली टीमें
सीमित बैकएंड इंफ्रास्ट्रक्चर वाले प्रोजेक्ट
विचार योग्य बातें
पूर्ण सिंक के लिए Couchbase Sync Gateway की आवश्यकता होती है
Android और iOS प्लेटफॉर्म तक सीमित
सिंक गेटवे इंटीग्रेशन के लिए अतिरिक्त सेटअप
NoSQL स्कीमा डिज़ाइन के लिए सीखने का वक्र
सरल डेटा की आवश्यकताओं के लिए संभावित अतिरिक्त लागत
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
couchbase_lite plugin
A Flutter plugin for Couchbase Lite Community Edition. An embedded lightweight, noSQL database with live synchronization and offline support on Android and iOS.
The goal of this project is to align this library with the Swift SDK API for Couchbase Lite.
Note: This plugin is still under development, and some APIs might not be available yet.
Feedback and Pull Requests are most welcome!
Note: Included in this example is sync-gateway-config.json (Login => u: foo, p: bar)
Usage example
Below is an example for the database using the BLoC pattern ( View <-> BLoC <-> Repository <-> Database )
// Initialize the databasetry {
database = awaitDatabase.initWithName("gettingStarted");
} onPlatformException {
return"Error initializing database";
}
// Create a new document (i.e. a record) in the database.var mutableDoc = MutableDocument()
.setDouble("version", 2.0)
.setString("type", "SDK");
// Save it to the database.try{
await database.saveDocument(mutableDoc);
} onPlatformException {
return"Error saving document";
}
// Update a document.
mutableDoc = (await database.document(mutableDoc.id))?.toMutable()?.setString("language", "Dart");
if (mutableDoc != null) {
// Save it to the database.try {
await database.saveDocument(mutableDoc);
vardocument = await database.document(mutableDoc.id);
// Log the document ID (generated by the database)// and propertiesprint("Document ID :: ${document.id}");
print("Learning ${document.getString("language")}");
} onPlatformException {
return"Error saving document";
}
}
// Create a query to fetch documents of type SDK.var query = QueryBuilder
.select([SelectResult.all().from("mydocs")])
.from("gettingStarted", as: "mydocs")
.where(Expression.property("type").from("mydocs").equalTo(Expression.string("SDK")));
// Run the query.try {
var result = await query.execute();
print("Number of rows :: ${result.allResults().length}");
} onPlatformException {
return"Error running the query";
}
// Note wss://10.0.2.2:4984/my-database is for the android simulator on your local machine's couchbase database// Create replicators to push and pull changes to and from the cloud.ReplicatorConfiguration config =
ReplicatorConfiguration(database, "ws://10.0.2.2:4984/beer-sample");
config.replicatorType = ReplicatorType.pushAndPull;
config.continuous = true;
// Add authentication.
config.authenticator = BasicAuthenticator("foo", "bar");
// Create replicator (make sure to add an instance or static variable named replicator)var replicator = Replicator(config);
// Listen to replicator change events.
_listenerToken = replicator.addChangeListener((ReplicatorChange event) {
if (event.status.error != null) {
print("Error: " + event.status.error);
}
print(event.status.activity.toString());
});
// Start replication.await replicator.start();
For this getting started guide, you will need to allow using ws protocol.
As of Android Pie, version 9, API 28, cleartext support is disabled, by default. Although wss: protocol URLs are not affected, in order to use the ws: protocol, applications must target API 27 or lower, or must configure application network security as described here.
App Transport Security is enabled by default since iOS 9 and enforces applications to use HTTPS exclusively. For this getting started guide, you will disable it but we recommend to enable it in production (and enable HTTPS on Sync Gateway). In the Xcode navigator, right-click on Info.plist and open it as a source file.
Append the following inside of the XML tags to disable ATS.