Created
April 27, 2019 08:03
-
-
Save SAGARSURI/bdcb0418405d3010d0e7fb0eecf9ebfe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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