getNetworkProtocols method Null safety

Future<List<NetworkProtocol>> getNetworkProtocols()

This operation gets defined network protocols from a device. The device shall support the getNetworkProtocols command returning configured network protocols.

Implementation

Future<List<NetworkProtocol>> getNetworkProtocols() async {
  loggy.debug('getNetworkProtocols');

  final envelope = await transport.sendRequest(
      uri,
      transport
          .securedEnvelope(soap.DeviceManagementRequest.networkProtocols()));

  if (envelope.body.hasFault) {
    throw Exception(envelope.body.fault.toString());
  }

  return GetNetworkProtocolsResponse.fromJson(envelope.body.response!)
      .networkProtocols;
}