# flutter-design-pattern
**Repository Path**: hu_wt/flutter-design-pattern
## Basic Information
- **Project Name**: flutter-design-pattern
- **Description**: A shopper Flutter app that use BloC pattern and CRUD operations with different ways(memory/sqlite/http)
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-17
- **Last Updated**: 2020-12-18
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
The project is maintained by a non-profit organisation, along with an amazing collections of Flutter samples. We're trying to make continuous commits for changes along with the Flutter tech progress.
# The Desigin Pattern
## Goals for this sample
- Shows a state management approach using the [Provider](https://pub.dev/packages/provider) package,mainly use StreamProvider and ChangeNotifier.
- Show a logic for fetch data from different datasources as above graph.
## Memory fetch data
Change `repositories/catalog.dart`
```
const dataSource = 'memory';
```
`repositories/catalog.dart` A route distribution for fetching data
`memory/catalog.dart` All CURD operations will be here
`file/catalog.dart` Define data
## Sqlite fetch data
Change `repositories/catalog.dart`
```
const dataSource = 'db';
```
#### Notice
You can't use `cart.items.contains(item)` to compare catalog whether exists in cart,because use database reload data.Add `contains` method in cart controller,and use below
```
cart.contains(item.id)
```
## Todo
- Http implement
---
# Screen Shots
![]() |
![]() |
![]() |