Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mhmzdev/flutter-bloc-implementation
A very close implementation to actual bloc architecture that separates the data layer with business and presentation layer.
https://github.com/mhmzdev/flutter-bloc-implementation
Last synced: 16 days ago
JSON representation
A very close implementation to actual bloc architecture that separates the data layer with business and presentation layer.
- Host: GitHub
- URL: https://github.com/mhmzdev/flutter-bloc-implementation
- Owner: mhmzdev
- Created: 2022-10-27T08:14:59.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-27T13:11:17.000Z (about 2 years ago)
- Last Synced: 2024-10-30T04:52:12.854Z (2 months ago)
- Language: Dart
- Size: 216 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Weather App
It is very close implementation to actual bloc architecture: https://bloclibrary.dev/#/flutterweathertutorial
*Just includes the fetching of Weather at the moment, not other features*
### Implementation
It includes 4 layers:1. Data layer (data provider)
2. Repository layer
3. Business layer (cubit/state)
3. Presentation layer (front-end/UI)And you start coding them respectively. Overall concept for this architecture will be:
**Your Data Layer must be hidden/abstracted from your business/presentation layer, so the point of interaction will be the respository layer**
### Terminologies
#### Barrel
- Just a file that exports other files to clean-up imports### Extensions
#### Bloc
- VS Code extension: https://marketplace.visualstudio.com/items?itemName=FelixAngelov.bloc
- Dart Data Class Generator: https://marketplace.visualstudio.com/items?itemName=hzgood.dart-data-class-generator### Project structure
### Business and Presentation layer
```dart
lib
- extensions
- ...
- screens/
- weather/
- cubits (Business layer)
- weather_cubit.dart
- weather_state.dart
- models
- models.dart (Barrel)
- views (Presentation layer)
- weather_view.dart (Entry point of UI)
- widgets/
- error.dart
- loading.dart
- success.dart
- widgets.dart (Barrel)
```### Data and Repository layers
```dart
packages
- weather_data_provider/ (Data layer - Abstracted/Hidden)
- lib/
- src/
- models/
- models.dart (barrel)
- location.dart
- weather.dart
- weather_data_provider.dart (data provider implementation)
- weather_data_provider (Barrel)- weather_repository (Repository layer)
- lib/
- src/
- models
- models.dart (barrel)
- weather.dart
- weather_repository.dart (repository implementation)
- weather_repository.dart (barrel)
```