add cache for medicines

This commit is contained in:
Patrick Alvin Alcala 2025-03-21 15:33:00 +08:00
parent 518415aa4e
commit 92df0af895
12 changed files with 110 additions and 14 deletions

View file

@ -1,8 +1,10 @@
import 'dart:io';
import 'dart:typed_data';
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:path_provider/path_provider.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/typelist/functions/cache_gettypelist.dart';
@ -123,15 +125,11 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
final types = await _getTypesCache();
final manufacturers = await _getManufacturerCache();
print('generics: $generics, types: $types, manufacturers: $manufacturers');
if (!generics || !types || !manufacturers) {
if (await InternetConnectionChecker.instance.hasConnection) {
await _getGenerics();
await _getTypes();
await _getManufacturer();
// final sample = await _refMedicines.getList2();
} else {
if (mounted) {
showNotification(context, 'Error: No Internet Connection', false);