getTrack method
Retrieves detailed information about a specific track.
trackId: The Spotify ID of the track.
Returns a TrackModel object representing the track's data.
Implementation
Future<TrackModel?> getTrack(String trackId) async {
try {
// Make an API request to get track details
final response =
await _dio.get('https://api.spotify.com/v1/tracks/$trackId');
return TrackModel.fromMap(response.data);
} catch (e) {
return null;
}
}