078520f504
Riverpod FutureProvider that reads the caller's system-playlists build state. Consumed by the home Playlists row to decide between real and placeholder cards. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
958 B
Dart
28 lines
958 B
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import '../api/endpoints/me.dart';
|
|
import '../api/endpoints/playlists.dart';
|
|
import '../library/library_providers.dart' show dioProvider;
|
|
import '../models/playlist.dart';
|
|
import '../models/system_playlists_status.dart';
|
|
|
|
final playlistsApiProvider = FutureProvider<PlaylistsApi>((ref) async {
|
|
return PlaylistsApi(await ref.watch(dioProvider.future));
|
|
});
|
|
|
|
final playlistsListProvider =
|
|
FutureProvider.family<PlaylistsList, String>((ref, kind) async {
|
|
return (await ref.watch(playlistsApiProvider.future)).list(kind: kind);
|
|
});
|
|
|
|
final playlistDetailProvider =
|
|
FutureProvider.family<PlaylistDetail, String>((ref, id) async {
|
|
return (await ref.watch(playlistsApiProvider.future)).get(id);
|
|
});
|
|
|
|
final systemPlaylistsStatusProvider =
|
|
FutureProvider<SystemPlaylistsStatus>((ref) async {
|
|
final dio = await ref.watch(dioProvider.future);
|
|
return MeApi(dio).systemPlaylistsStatus();
|
|
});
|