triggerSlide method

Future triggerSlide({
  1. ProPresentation? presentation,
  2. int index = 0,
})

for immediate user feedback, we also update the current presentation in this function and don't wait for the response from ProPresenter

Implementation

Future triggerSlide({ProPresentation? presentation, int index = 0}) async {
  if (!controlling) return false;
  if (presentation == null && currentPresentation == null) return false;
  presentation ??= currentPresentation;
  state.currentPresentation = presentation;
  emit('presentation');

  // pro6 needs the path to be backslash escaped
  String pathToSend =
      parent.settings.is7 ? currentPresentationPath! : currentPresentationPath!.replaceAll('/', r'\/');
  return act("presentationTriggerIndex", args: {
    'slideIndex': parent.settings.is7 ? index.toString() : index,
    'presentationPath': pathToSend,
  });
}