getArtist method

Future<Artist?> getArtist(
  1. String artistId
)

Retrieves detailed information about a specific artist.

  • artistId: The Spotify ID of the artist.

Returns an Artist object representing the artist's data.

Implementation

Future<Artist?> getArtist(String artistId) async {
  try {
    // Make an API request to get artist details
    final response =
        await _dio.get('https://api.spotify.com/v1/artists/$artistId');
    return Artist.fromMap(response.data);
  } catch (e) {
    return null;
  }
}