-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I sort data by popularity from search response? #138
Comments
In the search, the access of the What would also be interesting is to extract common properties like @vovaklh, I would filter out the Album, Tracks etc. of the search results into a separate lists and sort each type by popularity. |
Yeah, we'd need to look into that |
Regarding this issue, I am suggesting this solution: class Popularity {
int? popularity;
} so that class Track extends TrackSimple implements Popularity {
...
} , so that it is possible to extract the types with a popularity property by implementing var search = await spotify.search.get('metallica').first(2);
search.forEach((pages) {
var pops = pages.items!.whereType<Popularity>().toList();
pops.sort((a, b) => a.popularity?.compareTo(b.popularity ?? 0) ?? 0);
...
} @rinukkusu @vovaklh What do you think? |
Now search response contains a List of pages. Each page contains tracks or albums, or something else. How I can combine tracks and albums on UI and sort data by popularity?
The text was updated successfully, but these errors were encountered: