Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@florent37
Last active December 11, 2018 09:53
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 florent37/d70ca900f2f97c58aa501f223c0bc754 to your computer and use it in GitHub Desktop.
Save florent37/d70ca900f2f97c58aa501f223c0bc754 to your computer and use it in GitHub Desktop.
class OmdbRepository {
final apiKey = "my_key";
const OmdbRepository();
Future<List<Movie>> searchMovies(String byName) async {
final response = await http.get('http://www.omdbapi.com/?s=$byName&apikey=$apiKey');
final jsonValue = json.decode(response.body);
return SearchResponse.fromJson(jsonValue).movies;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment