added cache for generics
This commit is contained in:
parent
1aa7410e2e
commit
bcf9823ffb
13 changed files with 108 additions and 9 deletions
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:gap/gap.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:internet_connection_checker/internet_connection_checker.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/genericlist/functions/cache_getgenericlist.dart';
|
||||
import 'package:pharmacy_mobile/functions/barcode_scan_function.dart';
|
||||
import 'package:pharmacy_mobile/functions/checkresult_function.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_categories.dart';
|
||||
|
|
@ -58,7 +59,14 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
|
|||
late String imageUrl = '';
|
||||
|
||||
Future<void> _getGenerics() async {
|
||||
_genericNameList = await _refGenericNames.getList();
|
||||
final cache = await cacheGetGenericList(context);
|
||||
|
||||
if (cache.isNotEmpty) {
|
||||
_genericNameList = cache;
|
||||
} else {
|
||||
_genericNameList = await _refGenericNames.getList();
|
||||
}
|
||||
|
||||
setState(() {
|
||||
checkResult(context, _genericNameList, 'Generics');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue