added cache for generics
This commit is contained in:
parent
1aa7410e2e
commit
bcf9823ffb
13 changed files with 108 additions and 9 deletions
|
|
@ -0,0 +1,8 @@
|
|||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/genericlist/genericlist_cache_bloc.dart';
|
||||
|
||||
void cacheGenericListDispose(BuildContext context) async {
|
||||
final cache = context.read<GenericListBloc>();
|
||||
cache.close();
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/genericlist/genericlist_cache_bloc.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/genericlist/genericlist_cache_event.dart';
|
||||
|
||||
Future<List> cacheGetGenericList(BuildContext context) async {
|
||||
try {
|
||||
final genericListCache = context.read<GenericListBloc>();
|
||||
genericListCache.add(GenericListCacheGet());
|
||||
return genericListCache.state.value;
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/genericlist/genericlist_cache_bloc.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/genericlist/genericlist_cache_event.dart';
|
||||
|
||||
Future<bool> cacheSetGenericList(BuildContext context, List value) async {
|
||||
try {
|
||||
final genericListCache = context.read<GenericListBloc>();
|
||||
genericListCache.add(GenericListCacheSet(value));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue