सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
RxNotifier एक Flutter/Dart पैकेज है जो ValueNotifier को स्पष्ट कार्यात्मक प्रतिक्रियाशील प्रोग्रामिंग (TFRP) के साथ विस्तारित करता है। यह फंक्शनल ऑपरेटर्स का उपयोग करके राज्य परिवर्तनों को संयोजित और रूपांतरित करने की अनुमति देकर प्रतिक्रियाशील राज्य प्रबंधन को सक्षम बनाता है, जबकि ValueNotifier की सरलता बनाए रखता है। पैकेज मौजूदा Flutter ऐप्स में आसानी से एकीकृत होता है, जो प्रतिक्रियाशील पैटर्न के साथ राज्य प्रबंधन के लिए हल्का विकल्प प्रदान करता है बिना बॉइलरप्लेट के। यह सभी प्रमुख प्लेटफॉर्म का समर्थन करता है और अपरिवर्तनीय अपडेट और स्ट्रीम-जैसे रूपांतरणों के माध्यम से साफ़, परीक्षण योग्य कोड को बढ़ावा देता है।
उपयोग
प्रतिक्रियाशील उपयोगकर्ता संवाद स्थिति अद्यतन
जटिल राज्य तर्क का संयोजन
बहुत सारे ValueNotifiers को बदलना
राज्य रूपांतरण को सरल बनाना
प्रतिक्रियाशील फॉर्म बनाना
असिंक्रोनस स्थिति का प्रबंधन
मुख्य विशेषताएँ
कार्यात्मक प्रतिक्रियाशील प्रोग्रामिंग
ट्रांसपेरेंट टीएफआरपी इंटीग्रेशन
अपरिवर्तनीय राज्य अद्यतन
स्ट्रीम-जैसे ऑपरेटर
न्यूनतम बॉयलरप्लेट
क्रॉस-प्लेटफ़ॉर्म समर्थन
इनके लिए उपयुक्त
प्रतिक्रियाशील अवस्था प्रबंधन की तलाश में विकासकर्ता
संयोज्य राज्य तर्क की आवश्यकता वाले ऐप्स
कार्यात्मक प्रोग्रामिंग के प्रति प्रसन्न टीमें
भारी अवस्था प्रबंधन से बचने वाले परियोजनाएँ
Flutter के शुरुआती लोग प्रतिक्रियाशील पैटर्न सीख रहे हैं
हल्के राज्य समाधान की आवश्यकता वाले ऐप्स
विचार योग्य बातें
कार्यात्मक प्रोग्रामिंग के अवधारणाओं की समझ की आवश्यकता है
शुरुआती लोगों के लिए सीखने का वक्र पेश कर सकता है
ValueNotifier पर आधारित प्रतिक्रियाशील पैटर्न तक सीमित
बहुत बड़े पैमाने पर राज्य प्रबंधन के लिए उपयुक्त नहीं
मध्यम जटिलता वाली अवस्था की आवश्यकताओं के लिए सबसे उपयुक्त
पूर्ण प्रतिक्रियाशील फ्रेमवर्क (जैसे RxDart) को प्रतिस्थापित नहीं करता है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
rx_notifier
The ValueNotifier is a simple, native form of Flutter reactivity.
This extension aims to transparently apply functional reactive programming (TFRP).
It is possible to implement Recoil Atoms pattern using RxNotifier.
This pattern consists of the state being an object with its own reactivity.
Motivation
Developers still have trouble understanding state management in Flutter.
We had this conclusion after several research in the community fluttering and also
in partner companies.
Atomic State is a noob-friendly state management approuch at the same time
that maintains a reliable structure thinking of scalability and maintenance.
We must take into account some architectural limits to execute this Approach:
All states must be an atom(RxNotifier instance).
All actions must be an atom(RxNotifier instance).
Business rules must be created in the Reducer and not in the Atom.
Layers
We will have 3 main layers, they are: Atoms, Reducers and Views;
Note that the View (which is the presentation layer) does not know about the Reducer (which is the business rule execution layer).
These two layers share atoms that in turn represent the state and the dispatch of state actions.
In Flutter these layers translate to Atom(RxNotifier), Reducer(RxReducer) and View(Widget):
Atoms (RxNotifier)
Atom represent the reactive state of an application.
Each atom has its own reactivity.
In this architecture you are forced to split state management
of business rules, which may seem strange at first when seen
that we are always managing and reducing state in the same layer as BLoC and ChangeNotifier for example.
However, dividing state management and business rule execution will help us distribute multiple states to the same widget, and these multiple states will not need to be concatenated beforehand through a facade or proxy.
The layer responsible for making business decisions will be called Reducer:
Reducers can register methods/functions that listen to the reactivity of an Atom(RxNotifier).
View (Widget)
Any widget can listen to changes of one or many atoms,
provided they have the RxRoot widget as their ancestor.
For more details about RxRoot, Read the documentation.
The context.select() method is added via Extension to BuildContext and can be called on any type of Widget, StatefulWidget and StatelessWidget.