fix caching on add medicines

This commit is contained in:
Patrick Alvin Alcala 2025-03-21 10:20:28 +08:00
parent 5c4c8ceca9
commit 518415aa4e
8 changed files with 116 additions and 26 deletions

View file

@ -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 [];
}
}

View file

@ -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;
}
}