dispose method

Future<void> dispose()

dispose de video_player controller

Implementation

Future<void> dispose() async {
  if (windows) {
    _timer?.cancel();
    _timerForVolume?.cancel();
    _timerForGettingVolume?.cancel();
    timerForTrackingMouse?.cancel();
    _timerForSeek?.cancel();
    videoFitChangedTimer?.cancel();

    _position.close();
    _playerEventSubs?.cancel();
    _sliderPosition.close();
    _duration.close();
    _buffered.close();
    _closedCaptionEnabled.close();
    _mute.close();
    _fullscreen.close();
    _showControls.close();
    HotKeyManager.instance.unregisterAll();
    playerStatus.status.close();
    dataStatus.status.close();
    removeWindowsListener();
    _videoPlayerControllerWindows?.dispose();
    _videoPlayerControllerWindows = null;
  } else {
    if (_videoPlayerController != null) {
      _timer?.cancel();
      _timerForVolume?.cancel();
      _timerForGettingVolume?.cancel();
      timerForTrackingMouse?.cancel();
      _timerForSeek?.cancel();
      videoFitChangedTimer?.cancel();
      _position.close();
      _playerEventSubs?.cancel();
      _sliderPosition.close();
      _duration.close();
      _buffered.close();
      _closedCaptionEnabled.close();
      _mute.close();
      _fullscreen.close();
      _showControls.close();
      playerStatus.status.close();
      dataStatus.status.close();
      _videoPlayerController?.removeListener(this._listener);
      await _videoPlayerController?.dispose();
      _videoPlayerController = null;
    }
  }
}