flutter bloc pattern
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 bloc pattern
goals for this sample
- shows a state management approach using the 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
Comments are closed.