You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- import 'package:farm_tpf/custom_model/NotificationObjectDTO.dart';
- import 'package:farm_tpf/data/repository/repository.dart';
- import 'package:rxdart/rxdart.dart';
-
- class UpdateCountNotiBloc {
- final _repository = Repository();
- final _notiFetcher = PublishSubject<dynamic>();
-
- Stream<dynamic> get actions => _notiFetcher.stream;
-
- void getNotifications(Function(NotificationObjectDTO) onSuccess,
- Function(String) onError) async {
- _repository.getNotifications().then((value) {
- print('get noti ok ${value.numberUnreadTotal}');
- onSuccess(value);
- _notiFetcher.sink.add(value);
- }).catchError((onError) {
- onError(onError);
- _notiFetcher.addError(onError);
- });
- }
-
- void dispose() async {
- await _notiFetcher.drain();
- _notiFetcher.close();
- }
- }
-
- final updateCountNotiBloc = UpdateCountNotiBloc();
|