parseSearchResult static method

ArtistDetailed parseSearchResult(
  1. dynamic item
)

Implementation

static ArtistDetailed parseSearchResult(dynamic item) {
  final columns = traverseList(item, ["flexColumns", "runs"])
      .expand((e) => e is List ? e : [e])
      .toList();

  // No specific way to identify the title
  final title = columns[0];

  return ArtistDetailed(
    type: "ARTIST",
    artistId: traverseString(item, ["browseId"]) ?? '',
    name: traverseString(title, ["text"]) ?? '',
    thumbnails: traverseList(item, ["thumbnails"])
        .map((item) => ThumbnailFull.fromMap(item))
        .toList(),
  );
}