getAvailableDevices method

Future<List<Device>> getAvailableDevices()

Retrieves a list of available devices where playback can be controlled.

Implementation

Future<List<Device>> getAvailableDevices() async {
  final uri = Uri.https(_baseApiHost, '/v1/me/player/devices');
  final json = await _getJson(uri);

  final devices = json['devices'] as List<dynamic>;
  return devices.map((d) => Device.fromJson(d)).toList();
}