loadPreviousPresentation method

Future<bool> loadPreviousPresentation()

Implementation

Future<bool> loadPreviousPresentation() async {
  if (currentPresentation == null) return false;

  // if a presentation is in a playlist, it's path will contain `:`
  var pathParts = currentPresentation!.presentationPath.split(':');
  if (pathParts.length < 2) return false;

  var docNum = int.tryParse(pathParts.removeLast()) ?? 0;
  docNum--;
  pathParts.add(docNum.toString());
  var nextPath = pathParts.join(':');
  await loadPresentation(path: nextPath);
  return true;
}