rinukkusu / spotify-dart

A dart library for interfacing with the Spotify API.
BSD 3-Clause "New" or "Revised" License
191 stars 91 forks source link

`DeviceType` 'Smartwatch' is missing #177

Closed cudajo closed 7 months ago

cudajo commented 8 months ago

When calling SpotifyAPI.player.devices() it sometimes generates following error:

Invalid argument(s): `Smartwatch` is not one of the supported values: Computer, Tablet, Smartphone, Speaker, TV, AVR, STB, AudioDongle, GameConsole, CastVideo, CastAudio, Automobile, Unknown

When the exception was thrown, this was the stack: 
#0      $enumDecodeNullable (package:json_annotation/src/enum_helpers.dart:37:5)
#1      _$DeviceFromJson (package:spotify/src/models/_models.g.dart:488:12)
#2      new Device.fromJson (package:spotify/src/models/device.dart:11:57)
#3      PlayerEndpoint._parseDeviceJson.<anonymous closure> (package:spotify/src/endpoints/player.dart:80:39)
#4      MappedListIterable.elementAt (dart:_internal/iterable.dart:415:31)
#5      ListIterator.moveNext (dart:_internal/iterable.dart:344:26)
#6      _iterablePartsToStrings (dart:core/iterable.dart:933:13)
#7      Iterable.iterableToShortString (dart:core/iterable.dart:843:7)

I assume me having Spotify installed on my smart watch (Samsung Galaxy Watch 4) causes this issue when checking for available devices, as 'Smartwatch' isn't one of the enumerated DeviceTypes.

(Interestingly enough, and despite not having used my smart watch to play Spotify recently, the call to SpotifyAPI.player.devices() only sometimes seems to discover my smart watch as an available device. And when checking the official Spotify app in my phone at the same time this happens, it does not show my smart watch as available...)