fix(flutter): PlaylistsApi.list parses {owned, public} envelope

The server has always returned an enveloped response from GET
/api/playlists; the existing client decoded it as a flat List which
fails at runtime against the actual Map shape. Existing playlists
list screen would have been broken on any production instance.

list() now returns PlaylistsList { owned, public }. The existing
list screen consumes lists.all (owned + public flattened) — same
visible output as the previous flat-list assumption.

This unblocks the home parity slice which needs the same endpoint
for the new Playlists row.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-09 11:35:34 -04:00
parent 28b07c7ef4
commit 5613fec5ef
3 changed files with 32 additions and 12 deletions
@@ -31,7 +31,8 @@ class PlaylistsListScreen extends ConsumerWidget {
error: (e, _) => Center(
child: Text('$e', style: TextStyle(color: fs.error)),
),
data: (items) {
data: (lists) {
final items = lists.all;
if (items.isEmpty) {
return Center(
child: Text(
@@ -9,7 +9,7 @@ final playlistsApiProvider = FutureProvider<PlaylistsApi>((ref) async {
});
final playlistsListProvider =
FutureProvider.family<List<Playlist>, String>((ref, kind) async {
FutureProvider.family<PlaylistsList, String>((ref, kind) async {
return (await ref.watch(playlistsApiProvider.future)).list(kind: kind);
});