Triple은 분할 상태 패턴을 기반으로 한 상태 관리 솔루션으로, Flutter 애플리케이션에서 상태 처리를 간소화하기 위해 설계되었습니다. 데이터, 로딩 및 오류 상태를 캡슐화하는 Triple Store를 통해 상태 관리를 위한 명확한 추상화를 제공합니다. 이 패턴은 예측 가능한 상태 전환을 촉진하고 관심사의 분리를 통해 코드 가독성을 향상시킵니다. 최소한의 빌러플레이트로 구조적이고 확장 가능한 상태 로직이 필요한 앱에 적합합니다.
사용 사례
복잡한 앱 상태 관리
비동기 작업 처리
재사용 가능한 상태 로직 구현
확장 가능한 UI 컴포넌트 빌드
오류 및 로딩 상태 관리 간소화
주요 기능
세그먼트 상태 패턴 구현
상태 관리용 트리플 스토어
로딩, 성공 및 오류 상태에 대한 내장 지원
최소한의 보일러플레이트
Flutter 위젯과의 간편한 통합
적합한 대상
구조적 상태 관리를 원하는 개발자
상태 유형을 명확히 분리해야 하는 프로젝트
예측 가능한 상태 전이를 원하는 팀
자주 비동기 작업을 수행하는 앱
Flutter 초보자가 상태 패턴을 배우는 중
고려 사항
세그먼트 상태 패턴에 대한 이해가 필요합니다
간단한 상태 요구 사항에 대해 오버헤드를 추가할 수 있습니다
상태 분할이 유익한 사용 사례에 한정됨
모든 상태 관리 솔루션의 완전한 대체물은 아님
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
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)