added refresh of medicine cache
This commit is contained in:
parent
a2117b926f
commit
d130aef56c
1 changed files with 13 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import 'package:internet_connection_checker/internet_connection_checker.dart';
|
|||
import 'package:pharmacy_mobile/blocs/caches/distributorlist/functions/cache_getdistributorlist.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/genericlist/functions/cache_getgenericlist.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/manufacturerlist/functions/cache_getmanufacturerlist.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/medicinelist/functions/cache_setmedicinelist.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/supplierlist/functions/cache_getsupplierlist.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/typelist/functions/cache_gettypelist.dart';
|
||||
import 'package:pharmacy_mobile/functions/barcode_scan_function.dart';
|
||||
|
|
@ -168,6 +169,16 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> _getMedicineListCache() async {
|
||||
final medicineList = await _refMedicines.getList();
|
||||
|
||||
if (medicineList.isNotEmpty) {
|
||||
// ignore: use_build_context_synchronously
|
||||
final setCache = await cacheSetMedicineList(context, medicineList);
|
||||
if (!setCache) {}
|
||||
}
|
||||
}
|
||||
|
||||
void autoRun() async {
|
||||
final generics = await _getGenericsCache();
|
||||
final types = await _getTypesCache();
|
||||
|
|
@ -281,6 +292,8 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
|
|||
encrpytedBarcode, medDistributorUUID, medSupplierUUID, imageUUID);
|
||||
|
||||
if (posted) {
|
||||
_getMedicineListCache();
|
||||
|
||||
if (mounted) {
|
||||
showNotification(context, 'Medicine Added Successfully', true);
|
||||
setState(() => _isLoading = false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue