Skip to content

Instantly share code, notes, and snippets.

@SAGARSURI
Created April 27, 2019 08:03
Show Gist options
  • Save SAGARSURI/bdcb0418405d3010d0e7fb0eecf9ebfe to your computer and use it in GitHub Desktop.
Save SAGARSURI/bdcb0418405d3010d0e7fb0eecf9ebfe to your computer and use it in GitHub Desktop.
class MoviesBloc {
final _repository = Repository();
final _moviesFetcher = PublishSubject<ItemModel>();
Observable<ItemModel> get allMovies => _moviesFetcher.stream;
fetchAllMovies() async {
ItemModel itemModel = await _repository.fetchAllMovies();
_moviesFetcher.sink.add(itemModel);
}
dispose() {
_moviesFetcher.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment