Aus öffentlichen Paketdaten erstellte Orientierung.
Flutter Triple ist eine Zustandsverwaltungslösung, die das Segmentierte-Zustands-Muster (SSP) implementiert, das allgemein als 'Triple' bekannt ist. Es bietet eine saubere und vorhersagbare Möglichkeit, die Anwendungsstate durch Trennung von Daten-, Lade- und Fehlerzuständen zu verwalten. Für Einfachheit und Skalierbarkeit entwickelt, integriert es sich nahtlos in das reaktive Ökosystem von Flutter. Das Paket fördert die Codeorganisation und reduziert Boilerplate, wodurch es ideal für Entwickler wird, die eine leichte, aber leistungsstarke Alternative zu traditionellen Ansätzen der Zustandsverwaltung suchen. Es unterstützt alle wichtigen Plattformen, einschließlich Android, iOS, Web, macOS, Windows und Linux.
Anwendungsfälle
Komplexe UI-Zustände in Flutter-Anwendungen verwalten
Asynchrone Operationen mit klaren Lade- und Fehlerzuständen behandeln
Skalierbare und wartbare Zustandslogik erstellen
Vereinfachung von Zustandsübergängen in reaktiven Benutzeroberflächen
Integration mit Dependency Injection-Frameworks
Boilerplate in der Zustandsverwaltung reduzieren
Hauptmerkmale
Klare Trennung der Zustandsarten (anfänglich, erfolgreich, laden, fehlgeschlagen)
Integrierte Unterstützung für asynchrone Vorgänge
Reaktive Updates über StreamBuilder und ValueListenableBuilder
Minimale Boilerplate mit intuitiver API
Komponierbare und erweiterbare Zustandsmuster
Plattformübergreifende Kompatibilität
Geeignet für
Entwickler, die eine leichte Zustandsverwaltungslösung suchen
Teams, die eine konsistente Zustandsverwaltung über Projekte hinweg wünschen
Apps mit häufigen asynchronen Operationen
Projekte, die Abhängigkeitsinjektion verwenden
Anfänger lernen Zustandsverwaltungs-Muster
Großskalige Anwendungen, die wartbare Zustandslogik erfordern
Hinweise
Erfordert Verständnis des Triple-Pattern-Konzepts
Für fortgeschrittene Anwendungsfälle ist möglicherweise zusätzliche Einrichtung erforderlich
Eingeschränkte integrierte Debugging-Tools im Vergleich zu vollständigen Frameworks
Am besten geeignet für Apps, bei denen die Zustandskomplexität ihre Struktur rechtfertigt
Nicht ideal für sehr einfache Zustandsbedürfnisse ohne asynchrone Logik
Benötigt externe Bibliotheken für vollständige Funktionalität
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
Triple - Segmented State Pattern
Welcome to Triple!
Design Pattern for State Management.
Triple is a nickname to SSP (Segmented State Standard).
Some packages were created to make it easier for developers to start using the standard. We'll call it an extension.
Segmented State Pattern (SSP)
When we talk about a single flow state, we end up solving architecture problems early, as we will have only one data flow for each state.
In addition to the maintainability and to the ease of use architecture, we also have the possibility of increasing this flow with other standards such as the Observer, which gives reactivity to the component when it is modified, and Memento, which makes it possible to revert or redo this state.
A beautiful example of a pattern with a single flow is BLoC, giving reactivity to a state allowing all transformations in that flow. This (although complicated for some), consolidates very well in the architecture of a project, even the limits of this practice are beneficial for not allowing the developer to resort to other solutions for the architecture and the standard for its resource.
There are other ways to promote reactivity in a property instead of the entire object, such as MobX's Observable and Flutter's ValueNotifier, and that gives us a lot of choices. However, we lose some important architecture limits, which can put in check the project maintenance in the future. Therefore, it needs a standard to force limits on the individual reactivity of each property and thereby improve the maintainability of the components responsible for managing the states of the application.
Triple is a nickname to SSP (Segmented State Standard). Some packages were created to make it easier for developers to start using the standard. We'll call it an extension.
This project is distributed under the MIT License. See LICENSE.txt for more information.
✨ Usage
The SSP segments the state into 3 reactive parts, the state value (state), the error object (error), and the state loading action (loading).
These segments are observed in a listener or separate listeners. They can also be combined to obtain a new segment, always starting from the 3 main segments.
Installation
Dependencies
add the following dependencies to your pubspec.yaml file:
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the appropriate tag.
Don't forget to give the project a star! Thanks again!
Fork the Project
Create your Feature Branch (git checkout -b feature/AmazingFeature)
Commit your Changes (git commit -m 'Add some AmazingFeature')
Push to the Branch (git push origin feature/AmazingFeature)