सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
FunctionalData एक Dart पैकेज है जो लेंस बनाने के लिए एनोटेशन और उपयोगी सहायता प्रदान करता है—एक फंक्शनल प्रोग्रामिंग निर्माण जिसका उपयोग नेस्टेड डेटा संरचनाओं को एक्सेस और संशोधित करने के लिए किया जाता है। यह `function_data_generator` कोड जनरेटर के साथ सहयोग करता है ताकि बॉइलरप्लेट-मुक्त, अपरिवर्तनीय डेटा क्लासेस को स्वचालित रूप से उत्पन्न किया जा सके जिनमें शक्तिशाली अद्यतन क्षमताएँ हों। पैकेज गहरे नेस्टेड ऑब्जेक्ट्स के लिए सुरक्षित, एकीकृत अद्यतन की अनुमति देता है बिना म्यूटेशन के, जिससे Flutter और Dart एप्लिकेशन में फंक्शनल प्रोग्रामिंग सिद्धांतों को बढ़ावा मिलता है। राज्य प्रबंधन और डेटा रूपांतरण कार्यप्रवाह के लिए आदर्श।
उपयोग
अपरिवर्तनीय राज्य अद्यतन
नेस्टेड डेटा संचालन
Flutter ऐप में अवस्था प्रबंधन
फंक्शनल प्रोग्रामिंग पैटर्न
डेटा क्लासेज़ के लिए कोड जनरेशन
मुख्य विशेषताएँ
स्वचालित लेंस उत्पादन
अपरिवर्तनीयता समर्थन
गहन नेस्टेड अपडेट्स
प्रकार सुरक्षित रूपांतरण
कोड जनरेटर्स के साथ एकीकरण
इनके लिए उपयुक्त
कार्यात्मक प्रोग्रामिंग का उपयोग करने वाले डेवलपर्स
जटिल राज्य वाले Flutter ऐप
अपरिवर्तनीयता को प्राथमिकता देने वाली टीमें
कोड जनरेशन वर्कफ़्लो
डेटा-भारी एप्लिकेशन
विचार योग्य बातें
के आवश्यकता है `function_data_generator`
लेंस के लिए सीखने का वक्र
सीमित रनटाइम प्रतिबिंब
सरल डेटा मॉडल्स के लिए उपयुक्त नहीं
अतिरिक्त बिल्ड चरण की आवश्यकता है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
Functional Data
Simple and non-intrusive code generator for boilerplate of data types. The package generates a simple mixin with
operator==, hashCode, copyWith, toString, as well as lenses.
Boiler plate
Because the boiler plate is generated as a mixin, it is minimally intrusive on the interface of the class. You
only have to provide a constructor with named arguments for all fields and extend the generated mixin.
Because of this design, you have complete control over the class. You can, for example, add named constructors
or methods to the class like you're used to.
Lenses
For every class, lenses are generated for all fields which allow viewing a field or creating a new
instance of the classes with that field modified in some way. For example, the lens of Person's name is
Person$.name. To focus a lens on a specific instance use its of method:
This isn't very exciting yet. The power of lenses comes to light when you combine them. It allows you to easily
create a copy of a large nested data structure with one of the fields in a leaf modified. Two lenses can be chained
using then.
To specify which features should be generated for you whole project, create a file called functional_data_options.yaml
in the root of your project.
Class specific arguments will override the project level configuration.