onMessage method

dynamic onMessage(
  1. String message
)

Implementation

onMessage(String message) async {
  final DeviceInfo? info = await _upnp_msg_parser(message).parse();
  if (info != null) {
    final newFound = !deviceList.containsKey(info.URLBase);
    deviceList[info.URLBase] = DLNADevice(info);
    final now = DateTime.now();
    if (newFound || now.difference(t).inSeconds.abs() > 5) {
      if (!devices.isClosed) {
        devices.add(deviceList);
        t = now;
      }
    }
  }
}