diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-20 14:05:21 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-20 14:05:21 +0300 |
| commit | b7b2d404d035f4d83a5f3a2dc66055551dd022d3 (patch) | |
| tree | fee3ac53bab0ed6fa294bb90334022393e97e624 /player-android/lib/api/player_api_client.dart | |
| parent | 67c90f9b9a7a861e0f6ab0f199d66cd411948fab (diff) | |
Fix PlayerApiClient const constructor and Media.tags deserialization (d9+e9)
- Remove const from PlayerApiClient constructor (Uri is not const-constructable)
- Replace .cast<String>() with .whereType<String>().toList() in Media.fromJson
to silently drop non-string and null tag elements instead of throwing TypeError
- Add regression test: tags [1, 'valid', null] deserialized as ['valid']
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Diffstat (limited to 'player-android/lib/api/player_api_client.dart')
| -rw-r--r-- | player-android/lib/api/player_api_client.dart | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/player-android/lib/api/player_api_client.dart b/player-android/lib/api/player_api_client.dart index 3031c73..eb438f4 100644 --- a/player-android/lib/api/player_api_client.dart +++ b/player-android/lib/api/player_api_client.dart @@ -6,7 +6,9 @@ class PlayerApiClient { final Uri baseUrl; final String bearerToken; - const PlayerApiClient({required this.baseUrl, required this.bearerToken}); + // Normal (non-const) constructor: Uri is not const-constructable, so the + // constructor must not be declared const. + PlayerApiClient({required this.baseUrl, required this.bearerToken}); Future<User> bootstrap({required String username, required String password}) => throw UnimplementedError(); Future<User> login({required String username, required String password}) => throw UnimplementedError(); |
