Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created December 9, 2019 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azamsharp/7822c96892a3a7ee924373e4eadc7fb3 to your computer and use it in GitHub Desktop.
Save azamsharp/7822c96892a3a7ee924373e4eadc7fb3 to your computer and use it in GitHub Desktop.
class MovieListViewModel extends ChangeNotifier {
List<MovieViewModel> movies = List<MovieViewModel>();
Future<void> fetchMovies(String keyword) async {
final results = await Webservice().fetchMovies(keyword);
this.movies = results.map((item) => MovieViewModel(movie: item)).toList();
print(this.movies);
notifyListeners();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment