add cache for stocks
This commit is contained in:
parent
92df0af895
commit
de5a7c66a3
11 changed files with 134 additions and 3 deletions
20
lib/functions/getlist_cache_function.dart
Normal file
20
lib/functions/getlist_cache_function.dart
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import 'package:flutter/widgets.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/stocklist/functions/cache_getstocklist.dart';
|
||||
|
||||
Future<List> getListCache(BuildContext context, String type) async {
|
||||
late final List cache;
|
||||
|
||||
switch (type) {
|
||||
case 'stock':
|
||||
cache = await cacheGetStockList(context);
|
||||
break;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
|
||||
if (cache.isNotEmpty) {
|
||||
return cache;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue