|
|
@ -267,12 +267,11 @@ class Api {
|
|
|
|
|
|
|
|
|
|
|
|
removeFromPlaylist(String idTrack) async {
|
|
|
|
removeFromPlaylist(String idTrack) async {
|
|
|
|
var idPlaylist = await _getPlaylist();
|
|
|
|
var idPlaylist = await _getPlaylist();
|
|
|
|
if (idPlaylist == null) {
|
|
|
|
if (idPlaylist != null) {
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (await _isInPlaylist(idTrack, idPlaylist)) {
|
|
|
|
if (await _isInPlaylist(idTrack, idPlaylist)) {
|
|
|
|
var token = await _getAccessToken();
|
|
|
|
var token = await _getAccessToken();
|
|
|
|
var url = Uri.https('api.spotify.com', 'v1/playlists/$idPlaylist/tracks');
|
|
|
|
var url =
|
|
|
|
|
|
|
|
Uri.https('api.spotify.com', 'v1/playlists/$idPlaylist/tracks');
|
|
|
|
var jsonVar = jsonEncode(<String, List>{
|
|
|
|
var jsonVar = jsonEncode(<String, List>{
|
|
|
|
'tracks': [
|
|
|
|
'tracks': [
|
|
|
|
{'uri': 'spotify:track:$idTrack'}
|
|
|
|
{'uri': 'spotify:track:$idTrack'}
|
|
|
@ -286,6 +285,7 @@ class Api {
|
|
|
|
body: jsonVar));
|
|
|
|
body: jsonVar));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<String> getIdUser() async {
|
|
|
|
Future<String> getIdUser() async {
|
|
|
|
var url = Uri.https('api.spotify.com', 'v1/me');
|
|
|
|
var url = Uri.https('api.spotify.com', 'v1/me');
|
|
|
|