fixed cache
This commit is contained in:
parent
d3f708ae5e
commit
64516a7df2
7 changed files with 93 additions and 21 deletions
|
|
@ -2,6 +2,7 @@ import 'package:gap/gap.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:internet_connection_checker/internet_connection_checker.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/categorylist/functions/cache_getcategorylist.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/genericlist/functions/cache_setgenericlist.dart';
|
||||
import 'package:pharmacy_mobile/functions/checkexisting_function.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_categories.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_generic_names.dart';
|
||||
|
|
@ -36,6 +37,16 @@ class _AddGenericsPageState extends State<AddGenericsPage> {
|
|||
late String _selectedCategory = '';
|
||||
late String _categoryUUID = '';
|
||||
|
||||
Future<void> _getGenericListCache() async {
|
||||
final genericNameList = await _refGenericNames.getList();
|
||||
|
||||
if (genericNameList.isNotEmpty) {
|
||||
// ignore: use_build_context_synchronously
|
||||
final setCache = await cacheSetGenericList(context, genericNameList);
|
||||
if (!setCache) {}
|
||||
}
|
||||
}
|
||||
|
||||
void _getList() async {
|
||||
_categoryList = await _refCategories.getList();
|
||||
|
||||
|
|
@ -94,6 +105,7 @@ class _AddGenericsPageState extends State<AddGenericsPage> {
|
|||
final existing = await checkExisting(_refGenericNames, _nameController);
|
||||
|
||||
if (existing && mounted) {
|
||||
_getGenericListCache();
|
||||
showNotification(context, 'Generic Name already existing', false);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue