From 9aca972eb4620157677a2bf3330915a79889f09c Mon Sep 17 00:00:00 2001 From: Agoston Szepessy Date: Sun, 10 May 2026 17:08:09 -0700 Subject: [PATCH] Add `description` to `Item` for search results This is present on the Podcast Index API. --- lib/src/model/item.dart | 5 +++++ test/podcast_search_test.dart | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/src/model/item.dart b/lib/src/model/item.dart index 4ea89a8..dd6abf5 100644 --- a/lib/src/model/item.dart +++ b/lib/src/model/item.dart @@ -83,6 +83,9 @@ class Item { /// Full list of genres for the podcast. final List? genre; + // Channel level description. + final String? description; + Item({ this.artistId, this.collectionId, @@ -110,6 +113,7 @@ class Item { this.primaryGenreName, this.contentAdvisoryRating, this.genre, + this.description, }); /// Takes our json map and builds a Podcast instance from it. @@ -179,6 +183,7 @@ class Item { artworkUrl: json['image'] as String?, genre: genres, releaseDate: DateTime.fromMillisecondsSinceEpoch(pubDate.inMilliseconds), + description: json['description'] as String?, ); } diff --git a/test/podcast_search_test.dart b/test/podcast_search_test.dart index 6789965..71d416d 100644 --- a/test/podcast_search_test.dart +++ b/test/podcast_search_test.dart @@ -10,8 +10,9 @@ void main() { setUp(() { search = Search( - searchProvider: - PodcastIndexProvider(key: 'XXWQEGULBJABVHZUM8NF', secret: 'KZ2uy4upvq4t3e\$m\$3r2TeFS2fEpFTAaF92xcNdX'), + searchProvider: PodcastIndexProvider( + key: 'XXWQEGULBJABVHZUM8NF', + secret: 'KZ2uy4upvq4t3e\$m\$3r2TeFS2fEpFTAaF92xcNdX'), ); }); @@ -21,6 +22,20 @@ void main() { expect(result.resultCount > 0, true); }); + test('Podcast description', () async { + final result = await search.search('The Rest Is History'); + + final item = result.items.firstWhere( + (element) => + element.trackName + ?.toLowerCase() + .contains('the rest is history') ?? + false, + orElse: null); + expect(item, isNotNull); + expect(item.description, isNotNull); + }); + test('Max one result test', () async { final result = await search.search('Forest 404');