SHARE
TWEET

Untitled

a guest Mar 17th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:rxdart/rxdart.dart';
  2. import 'package:weather_bloc/src/models/condition_model.dart';
  3. import 'package:weather_bloc/src/resources/repository.dart';
  4.  
  5. class ConditionsBloc {
  6.   final _repository = Repository();
  7.   final _conditionsFetcher = PublishSubject<ConditionsModel>();
  8.  
  9.   Observable<ConditionsModel> get conditions => _conditionsFetcher.stream;
  10.  
  11.   fetchConditions() async {
  12.     ConditionsModel weatherConditions = await _repository.fetchWeatherData();
  13.     _conditionsFetcher.sink.add(weatherConditions);
  14.   }
  15.  
  16.   dispose() {
  17.     _conditionsFetcher.close();
  18.   }
  19. }
  20.  
  21. final blocConditions = ConditionsBloc();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top