togglePlayPause method

void togglePlayPause()

Implementation

void togglePlayPause() {
  final controller = state.videoPlayerController;
  if (controller != null) {
    if (controller.value.isPlaying) {
      controller.pause();
      state = state.copyWith(isPlaying: false);
      unawaited(WakelockPlus.disable());
    } else {
      controller.play();
      state = state.copyWith(isPlaying: true);
      unawaited(WakelockPlus.enable());
    }
  }
}