सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
Flutter Data एक सरलीकृत तरीका प्रदान करता है जिससे फ्लटर एप्लिकेशन में स्थायी डेटा मॉडल्स का प्रबंधन किया जा सकता है, जो एम्बर डेटा और एक्टिवरिकॉर्ड के प्रभाव से प्रेरित है। यह स्थानीय और दूरस्थ डेटा स्रोतों के लिए एक एकीकृत API प्रदान करके CRUD ऑपरेशन, राज्य प्रबंधन और उपकरणों के बीच डेटा सिंक्रनाइजेशन को सरल बनाता है। पैकेज फ्लटर के पारिस्थितिकी तंत्र के साथ बिना किसी अवरोध के एकीकृत होता है, जिसमें प्रकार-सुरक्षित मॉडल, स्वचालित सीरियलाइजेशन और आंतरिक कैशिंग समर्थित होती है। विकासकर्ता आसानी से डेटा मॉडल और संबंधों को परिभाषित कर सकते हैं, जिससे बॉइलरप्लेट कोड के बिना कार्यक्षम डेटा हैंडलिंग संभव होती है।
उपयोग
ऑफलाइन-प्रथम डेटा वर्कफ्लो का प्रबंधन
स्थानीय स्टोरेज और API के बीच डेटा सिंक करना
स्केलेबल CRUD एप्लिकेशन बिल्ड करना
जटिल डेटा संबंधों का प्रबंधन
प्रतिक्रियाशील डेटा अद्यतन कार्यान्वयन
मुख्य विशेषताएँ
स्वचालित मॉडल सीरियलाइज़ेशन
SQLite के साथ एम्बेडेड पर्सिस्टेंस
प्रतिक्रियाशील अवस्था प्रबंधन
REST और GraphQL APIs का समर्थन
प्रकार सुरक्षित डेटा मॉडल और प्रश्न
इनके लिए उपयुक्त
ऑफलाइन डेटा एक्सेस की आवश्यकता वाले ऐप्स
REST या GraphQL बैकएंड का उपयोग करने वाले प्रोजेक्ट
कम बॉलरप्लेट कोड चाहने वाले डेवलपर्स
MVC-जैसी डेटा संरचना को अपनाने वाली टीमें
जटिल डेटा संबंधों वाले अनुप्रयोग
विचार योग्य बातें
नए उपयोगकर्ताओं के लिए सीखने का ढलान
परिपक्व विकल्पों की तुलना में सीमित डॉक्यूमेंटेशन
कस्टम एंडपॉइंट्स के लिए अतिरिक्त सेटअप की आवश्यकता हो सकती है
बहुत सरल ऐप्स के लिए आदर्श नहीं है जिनकी न्यूनतम डेटा आवश्यकता होती है
बाहरी निर्भरताओं पर निर्भर करता है, जैसे json_serializable
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
Flutter Data
Persistent reactive models in Flutter with zero boilerplate
Flutter Data is a local-first data framework with a customizable REST client and powerful model relationships, built on Riverpod.
In Flutter Data, every model gets its default adapter. These adapters can be extended by mixing in custom adapters.
Annotate a model with @DataAdapter and pass a custom adapter:
@JsonSerializable()
@DataAdapter([MyJSONServerAdapter])
classUserextendsDataModel<User> {
@overridefinalint? id; // ID can be of any typefinalString name;
User({this.id, requiredthis.name});
// `User.fromJson` and `toJson` optional
}
mixinMyJSONServerAdapteronRemoteAdapter<User> {
@overrideStringget baseUrl => "https://my-json-server.typicode.com/flutterdata/demo/";
}
After code-gen, Flutter Data will generate the resulting Adapter<User> which is accessible via Riverpod's ref.users or container.users.
@overrideWidgetbuild(BuildContext context, WidgetRef ref) {
final state = ref.users.watchOne(1);
if (state.isLoading) {
returnCenter(child: constCircularProgressIndicator());
}
final user = state.model;
returnText(user.name);
}
ref.users.watchOne(1) will make a background HTTP request (to https://my-json-server.typicode.com/flutterdata/demo/users/1 in this case), deserialize data and listen for any further local changes to the user.
state is of type DataState which has loading, error and data substates.
In addition to the reactivity, models have ActiveRecord-style extension methods so the above becomes:
Appwrite Offline. A Flutter Data adapter for Appwrite that provides offline support, real-time updates, and seamless integration with Flutter Data's powerful features.
🚨 BREAKING CHANGES IN 2.0
All methods are now directly on Adapter, there is no Repository, RemoteAdapter or LocalAdapter. Any method you are looking for is probably on Adapter, for example, findAll from LocalAdapter is now called findAllLocal
For initialization we no longer call the configure... method on the Riverpod overrides, we just do localStorageProvider.overrideWithValue and pass a LocalStorage instance; the actual initialization is done via initializeFlutterData which needs an adapter map. An adapterProvidersMap is conveniently code-generated and available on main.data.dart
Offline operations are still supported, but retries are not, it is up to clients to implement them
📚 Public API
Initialization
First you need to supply a local storage provider, via Riverpod configuration. A popular option for the base directory is using the path_provider package.