brick_core 1.2.1 brick_core: ^1.2.1 copied to clipboard
Interfaces and shared helpers for implementing models, adapters, providers, and repositories in Brick, an intuitive way to work with persistent data in Dart.
Brick Core #
Interfaces and shared helpers for implementing models, adapters, providers, and repositories in Brick.
Principles #
Brick's architecture encourages using data through a single access point: the repository.
A repository may implement multiple providers, but after instantiation the end application is only aware of the repository. The stream of data follows one course through each provider:
The repository is aware of provider(s), the provider(s) are aware of the adapters, the adapters are aware of models, and the models are aware of only themselves. From the reverse, models are unaware, adapters are unaware of providers and providers are unaware of repositories.
Because models are atomic and unaware, they don't rely on (de)serializing functions (unlike with JSON serializable). Brick reduces the concerns of the end-implementation by hiding (de)serializing and fetching logic into adapters, which translate raw data between providers: