Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class SearchViewModel {
//Stream <=> MediatorLiveData
final StreamController<SearchViewState> _viewModelController = StreamController();
final OmdbRepository _repository;
//Stream <=> LiveData
Stream<SearchViewState> get viewState =>;
SearchViewModel(this._repository) {
void _start(){"avengers");
void search(String name) async {
var movies = await _repository.searchMovies(name);
_viewModelController.add(SearchViewState(movies: movies));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment