getCurrentPreset method Null safety

Future<ImagingPreset> getCurrentPreset(
  1. String videoSourceToken,
  2. {int? limit = 100}
)

Via this command the last Imaging Preset applied can be requested. If the camera configuration does not match any of the existing Imaging Presets, the output of GetCurrentPreset shall be Empty. GetCurrentPreset shall return 0 if Imaging Presets are not supported by the Video Source.

Implementation

Future<ImagingPreset> getCurrentPreset(String videoSourceToken,
    {int? limit = 100}) async {
  loggy.debug('getCurrentPreset');

  final envelope = await transport.sendRequest(
      uri,
      transport.securedEnvelope(
          soap.ImagingRequest.getCurrentPreset(videoSourceToken)));

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

  return GetCurrentPresetResponse.fromJson(envelope.body.response!).preset;
}