From a3c43a18b1deac2b628b8df86649cb37389d4c00 Mon Sep 17 00:00:00 2001 From: Andrea Bizzotto Date: Fri, 12 Apr 2024 14:22:05 +0100 Subject: [PATCH] Use URI in the MoviesRepository --- lib/src/features/movies/data/movies_repository.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/src/features/movies/data/movies_repository.dart b/lib/src/features/movies/data/movies_repository.dart index 6284661..11a74ee 100644 --- a/lib/src/features/movies/data/movies_repository.dart +++ b/lib/src/features/movies/data/movies_repository.dart @@ -19,7 +19,7 @@ class MoviesRepository { Future searchMovies( {required MoviesQueryData queryData, CancelToken? cancelToken}) async { - final url = Uri( + final uri = Uri( scheme: 'https', host: 'api.themoviedb.org', path: '3/search/movie', @@ -29,14 +29,14 @@ class MoviesRepository { 'page': '${queryData.page}', 'query': queryData.query, }, - ).toString(); - final response = await client.get(url, cancelToken: cancelToken); + ); + final response = await client.getUri(uri, cancelToken: cancelToken); return TMDBMoviesResponse.fromJson(response.data); } Future nowPlayingMovies( {required int page, CancelToken? cancelToken}) async { - final url = Uri( + final uri = Uri( scheme: 'https', host: 'api.themoviedb.org', path: '3/movie/now_playing', @@ -45,8 +45,8 @@ class MoviesRepository { 'include_adult': 'false', 'page': '$page', }, - ).toString(); - final response = await client.get(url, cancelToken: cancelToken); + ); + final response = await client.getUri(uri, cancelToken: cancelToken); return TMDBMoviesResponse.fromJson(response.data); }