add cache for stocks
This commit is contained in:
parent
92df0af895
commit
de5a7c66a3
11 changed files with 134 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:pharmacy_mobile/functions/getlist_cache_function.dart';
|
||||
import 'package:pharmacy_mobile/tables/stocks.dart';
|
||||
import 'package:pharmacy_mobile/widgets/datatable_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
||||
|
|
@ -63,7 +64,14 @@ class _ListStocksPageState extends State<ListStocksPage> {
|
|||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
_stockList = await _stocks.getList();
|
||||
|
||||
final cache = await getListCache(context, 'stock');
|
||||
|
||||
if (cache.isNotEmpty) {
|
||||
_stockList = cache;
|
||||
} else {
|
||||
_stockList = await _stocks.getList();
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue