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/data/repository/user_repository.dart';
- import 'package:rxdart/rxdart.dart';
-
- class GetAccountBloc {
- final _repository = UserRepository();
- final _getAccountFetcher = PublishSubject<dynamic>();
-
- Stream<dynamic> get actions => _getAccountFetcher.stream;
-
- void getAccount(Function(dynamic) onSuccess, Function(String) onError) async {
- _repository.getUser().then((value) {
- onSuccess(value);
- _getAccountFetcher.sink.add(value);
- }).catchError((onError) {
- onError(onError);
- _getAccountFetcher.addError(onError);
- });
- }
-
- void dispose() async {
- await _getAccountFetcher.drain();
- _getAccountFetcher.close();
- }
- }
-
- final getAccountBloc = GetAccountBloc();
|