https://github.com/maksimka101/convenient_architecture
https://github.com/maksimka101/convenient_architecture
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/maksimka101/convenient_architecture
- Owner: Maksimka101
- License: mit
- Created: 2022-08-16T11:37:41.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-10-16T01:00:52.000Z (over 1 year ago)
- Last Synced: 2025-02-13T01:48:47.666Z (4 months ago)
- Language: Dart
- Homepage:
- Size: 390 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# It is alpha
Some API may be changed.---
The collection of useful utils and architecture base classes.
## It consists of
- [`response_parser`](https://pub.dev/packages/response_parser) - helps to
parse responses and errors, and map them to the convenient `Either` format.
- [`fpdart`](https://pub.dev/packages/fpdart) and `functional_extensions` - main
functional programming types and patterns.
- [`action_bloc`](#action-blocs) - subtype of the bloc which converts an action execution to the
`inProgress` and `success`/`failure` states.
- [`facade_consumer_cubit`](#facade-consumer-cubit) - cubit which shortcuts the subscribing and
listening to the reactive facade.
- [`reactive_facade`](#reactive-facade) - helps to make the work with the infrastracture layer reactive.Take a look at the example app to see these parts in action
## Action blocs
Action bloc is used to automatically map `action` to the states. It's supposed to
be used with the `ReactiveFacade`.`action` is a function which performs an action that should be mapped to the states.
It may be similar to the `FutureBuilder` which also maps action to the states however
action blocs are more advanced.It works this way:
- event is added
- action is performed
- before actions is performed `in progress` state is emitted
- when action is successfully performed `success` state is emitted
- in case of failure `failure` state with an error is emitted.
To map an `action` to the states bloc is using `IStateAdapter`.
This is an adapter provided by user which takes an action with event, executes it
and returns an `Either` of result or error.### Facade consumer cubit
It's a base for the cubit which listens to the `ReactiveFacade.dataStream`.## Reactive facade
As you may know facade is a [pattern](https://refactoring.guru/design-patterns/facade)
which provides a simplified interface to complex set of classes.
In our case these classes are api and local repositories.**Reactive Facade's goal** is to be a single source of truth, hide the data synchronization
and provide the reactive api.