getDevices method

Future<Devices> getDevices()

Implementation

Future<Devices> getDevices() async {
  assert(sessionId != null && sessionId!.isNotEmpty, 'SessionId must not be null or empty');

  final url = Uri.parse('$baseUrl/data.lua');
  final body = <String, String>{
    'sid': sessionId!,
    'xhrId': 'all',
    'xhr': '1',
    'page': 'sh_dev',
  };
  final result = await post(url, body: body);
  final devices = Devices.fromJson(jsonDecode(result.body));

  return devices;
}