When I make a call to this function , it works if the artist and album has data without spaces. How would I change this to make it consider data with spaces .
static Future fetchAlbumDetailData(String albumName, String artist) async {
print('ALBUM NAME : $albumName');
print('ALBUM artist : $artist');
print(
'Link called is :https://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=$apiKey&artist=$artist&album=$albumName&format=json');
http.Response response = await retry(
// Make a GET request
() => http
.get(
Uri.parse(
'https://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=$apiKey&artist=$artist&album=$albumName&format=json'),
)
.timeout(const Duration(seconds: 5)),
// Retry on SocketException or TimeoutException
retryIf: (e) => e is SocketException || e is TimeoutException,
);
if (response.statusCode == 200) {
return response.body;
} else {
throw (response.statusCode);
}
}
My print statement output is :
I/flutter ( 5341): ALBUM NAME : Make Believe I/flutter ( 5341): ALBUM artist : Weezer I/flutter ( 5341): Link called is :https://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=755bf5e882b716dac814852b5e8e2e52&artist=Weezer&album=Make Believe&format=json
The link is destroyed between the words Make and Believe