getDeviceInfo method

  1. @override
Future<String> getDeviceInfo({
  1. int? port,
  2. String? path,
})
override

Required Port & path for web platform

Implementation

@override
Future<String> getDeviceInfo({int? port, String? path}) async {
  assert(port != null);
  assert(path != null);
  try {
    final client =
        await httpClient.openUrl("DEVICEINFO", Uri.parse("http://127.0.0.1:$port$path"));
    client.headers.set("Content-Type", "text/xml; charset=utf-8");
    client.headers.set("Accept", "text/xml");
    pluginDebug("Requesting device info at 127.0.0.1:$port$path");
    var data = await (await client.close()).transform(utf8.decoder).join();
    return data;
  } catch (e) {
    pluginDebug("--- Error on getDeviceInfo ---", e: e);
    rethrow;
  }
}