getDns method Null safety

Future<DnsInformation> getDns()

This operation gets the DNS settings from a device. The device shall return its DNS configurations through the GetDNS command.

Implementation

Future<DnsInformation> getDns() async {
  loggy.debug('getDns');
  final envelope = await Soap.retrieveEnvelope(
      uri, onvif.secureRequest(SoapRequest.dns()));

  if (envelope.body.dnsResponse == null) throw Exception();

  return envelope.body.dnsResponse!.dnsInformation;
}