{"id":20664000,"url":"https://github.com/flutterando/triple_pattern","last_synced_at":"2025-04-05T14:09:42.229Z","repository":{"id":38989172,"uuid":"323992648","full_name":"Flutterando/triple_pattern","owner":"Flutterando","description":"Segmented State Pattern for Reactive Property","archived":false,"fork":false,"pushed_at":"2024-03-11T18:55:12.000Z","size":6129,"stargazers_count":161,"open_issues_count":11,"forks_count":36,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-29T13:11:41.097Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Flutterando.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-23T20:09:39.000Z","updated_at":"2024-12-15T09:28:30.000Z","dependencies_parsed_at":"2024-03-11T19:55:32.373Z","dependency_job_id":null,"html_url":"https://github.com/Flutterando/triple_pattern","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flutterando%2Ftriple_pattern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flutterando%2Ftriple_pattern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flutterando%2Ftriple_pattern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flutterando%2Ftriple_pattern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Flutterando","download_url":"https://codeload.github.com/Flutterando/triple_pattern/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345856,"owners_count":20924102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T19:21:34.614Z","updated_at":"2025-04-05T14:09:42.207Z","avatar_url":"https://github.com/Flutterando.png","language":"Dart","readme":"\u003ca name=\"readme-top\"\u003e\u003c/a\u003e\n\n\u003c!--\n*** This template was base on othneildrew's Best-README-Template. If you have a suggestion that would make this better, please fork the repo and create a pull request if it's for the template as whole. \n\nIf it's for the Flutterando version of the template just send a message to us (our contacts are below)\n\n*** Don't forget to give his project a star, he deserves it!\n*** Thanks for your support! \n--\u003e\n\n\n  \u003ch1 align=\"center\"\u003eTriple - Segmented State Pattern\u003c/h1\u003e\n\n\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/othneildrew/Best-README-Template\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/Flutterando/triple_pattern/master/doc/static/img/docusaurus.png\" alt=\"Logo\" width=\"80\" style=\" padding-right: 30px;\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/Flutterando/README-Template/\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/Flutterando/README-Template/master/readme_assets/logo-flutterando.png\" alt=\"Logo\" width=\"95\"\u003e\n  \u003c/a\u003e\n\n  \u003cbr /\u003e\n  \u003cp align=\"center\"\u003e\n    Welcome to Triple!\n    Design Pattern for State Management. \n    \u003cbr\u003e\n    \u003cbr\u003e\n   \u003c!--  \u003ca href=\"https://triple.flutterando.com.br/docs/getting-started/example\"\u003eView Example\u003c/a\u003e --\u003e\n    ·\n    \u003ca href=\"https://github.com/Flutterando/triple_pattern/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/Flutterando/triple_pattern/issues\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n---\n\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\u003ca href=\"#about-the-project\"\u003eAbout The Project\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\u003c/li\u003e     \n    \u003col\u003e\n      \u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#how-to-use?\"\u003eHow to use?\u003c/a\u003e\u003c/li\u003e\n    \u003c/ol\u003e\n  \u003c/li\u003e     \n    \u003cli\u003e\u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contributors\"\u003eContributors\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n---\n\n\u003cbr\u003e\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n## \u003cdiv id=\"about-the-project\"\u003e:memo: About The Project\u003c/div\u003e\n\n### What is Triple?\n\nTriple is a nickname to SSP (Segmented State Standard).\nSome packages were created to make it easier for developers to start using the standard. We'll call it an extension.\n\n### Segmented State Pattern (SSP) \n\nWhen 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.\n\nIn 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.\n\nA 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.\n\nThere 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.\n\n\nTriple 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.\n\n\u003cbr\u003e\n\n\u003ci\u003eThis project is distributed under the MIT License. See `LICENSE.txt` for more information.\u003c/i\u003e\n\n\u003cbr\u003e\n\n## \u003cdiv id=\"usage\"\u003e✨ Usage\u003c/div\u003e\n\nThe SSP segments the state into 3 reactive parts, the state value (state), the error object (error), and the state loading action (loading).\n\nThese 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.\n\n## \u003cdiv id=\"installation\"\u003eInstallation\u003c/div\u003e\n\n### Dependencies\n\nadd the following dependencies to your `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  flutter_triple: ^1.3.0\n```\n\n### Import\n\nImport the package in your code with:\n```dart\nimport 'package:flutter_triple/flutter_triple.dart';\n```\n\n## \u003cdiv id=\"how-to-use?\"\u003eHow to use?\u003c/div\u003e\n\n### Create a Store\n\nCreate a class that extends `NotifierStore\u003cError, State\u003e`.\nThe first type is the type of the error, the second is the type of the state.\n\n\n```dart\nclass CounterStore extends NotifierStore\u003cException, int\u003e {\n  CounterStore() : super(0);\n\n  void increment() =\u003e update(state + 1);\n  void decrement() =\u003e update(state - 1);\n}\n```\n\n### Consume with Listeners, Builders and Consumers\n\nConsume the store with scopes `ScopedBuilder`, `ScopedListener` and `ScopedConsumer`.\n\n```dart\n\nclass CounterPage extends StatefulWidget {\n  @override\n  _CounterPageState createState() =\u003e _CounterPageState();\n}\n\nclass _CounterPageState extends State\u003cCounterPage\u003e {\n  final store = CounterStore();\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(\n        title: Text('Counter'),\n      ),\n      body: ScopedBuilder\u003cCounterStore, Exception, int\u003e(\n        store: store,\n        onLoading: (context) =\u003e Center(child: CircularProgressIndicator()),\n        onError: (context, error) =\u003e Center(child: Text(error.toString())),\n        onState: (context, state) =\u003e Center(\n          child: Text(\n            '$state',\n            style: Theme.of(context).textTheme.headline4,\n          ),\n        ),\n      ),\n      floatingActionButton: Row(\n          mainAxisAlignment: MainAxisAlignment.end,\n          children: [\n            FloatingActionButton(\n              onPressed: store.decrement,\n              tooltip: 'Decrement',\n              child: Icon(Icons.remove),\n            ),\n            SizedBox(width: 5),\n            FloatingActionButton(\n              onPressed: store.increment,\n              tooltip: 'Increment',\n              child: Icon(Icons.add),\n            ),\n          ],\n        ),\n    );\n  }\n}\n\n```\n\u003c!-- CONTRIBUTING --\u003e\n## \u003cdiv id=\"contributing\"\u003e🧑‍💻 Contributing\u003c/div\u003e\n\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\nIf 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.\nDon't forget to give the project a star! Thanks again!\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\nRemember to include a tag, and to follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) and [Semantic Versioning](https://semver.org/) when uploading your commit and/or creating the issue.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- CONTACT --\u003e\n## \u003cdiv id=\"contact\"\u003e💬 Contact\u003c/div\u003e\n\nFlutterando Community\n- [Discord](https://discord.gg/MKPZmtrRb4)\n- [Telegram](https://t.me/flutterando)\n- [Website](https://www.flutterando.com.br)\n- [Youtube Channel](https://www.youtube.com.br/flutterando)\n- [Other useful links](https://linktr.ee/flutterando)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\u003cbr\u003e\n\n\u003c!-- CONTRIBUTORS --\u003e\n## \u003cdiv id=\"contributors\"\u003e👥 Contributors\u003c/div\u003e\n\n\u003ca href=\"https://github.com/Flutterando/triple_pattern/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=flutterando/triple_pattern\" /\u003e\n\u003c/a\u003e\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- MANTAINED BY --\u003e\n## 🛠️ Maintaned by\n\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.flutterando.com.br\"\u003e\n    \u003cimg width=\"110px\" src=\"https://raw.githubusercontent.com/Flutterando/README-Template/master/readme_assets/logo-flutterando.png\"\u003e\n  \u003c/a\u003e\n  \u003cp align=\"center\"\u003e\n    This fork version is maintained by \u003ca href=\"https://www.flutterando.com.br\"\u003eFlutterando\u003c/a\u003e.\n  \u003c/p\u003e\n\u003c/p\u003e\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflutterando%2Ftriple_pattern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflutterando%2Ftriple_pattern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflutterando%2Ftriple_pattern/lists"}