fix caching on add medicines
This commit is contained in:
parent
5c4c8ceca9
commit
518415aa4e
8 changed files with 116 additions and 26 deletions
|
|
@ -0,0 +1,14 @@
|
|||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/manufacturerlist/manufacturerlist_cache_bloc.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/manufacturerlist/manufacturerlist_cache_event.dart';
|
||||
|
||||
Future<List> cacheGetManufacturerList(BuildContext context) async {
|
||||
try {
|
||||
final manufacturerListCache = context.read<ManufacturerListBloc>();
|
||||
manufacturerListCache.add(ManufacturerListCacheGet());
|
||||
return manufacturerListCache.state.value;
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/manufacturerlist/manufacturerlist_cache_bloc.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/manufacturerlist/manufacturerlist_cache_event.dart';
|
||||
|
||||
Future<bool> cacheSetManufacturerList(BuildContext context, List value) async {
|
||||
try {
|
||||
final manufacturerListCache = context.read<ManufacturerListBloc>();
|
||||
manufacturerListCache.add(ManufacturerListCacheSet(value));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue