gotoPreset method Null safety

Future<bool> gotoPreset(
  1. String profileToken,
  2. String presetToken,
  3. [PtzSpeed? speed]
)

Operation to go to a saved preset position for the Preset in the selected profile. The operation is supported if there is support for at least on PTZ preset by the Preset.

Implementation

Future<bool> gotoPreset(String profileToken, String presetToken,
    [PtzSpeed? speed]) async {
  loggy.debug('gotoPreset');

  final envelope = await Soap.retrieveEnvelope(
      uri,
      onvif.secureRequest(
          SoapRequest.gotoPreset(profileToken, presetToken, speed)));

  if (envelope.body.gotoPresetResponse == null) {
    throw Exception();
  }

  return true;
}