dispose method
void
dispose()
Implementation
void dispose() {
if (_isDisposed) return;
_isDisposed = true;
// Release player on native side
try {
methodChannel.invokeMethod(Constant.METHOD_RELEASE_PLAYER);
} catch (_) {}
// Cancel timer first
_timer?.cancel();
_timer = null;
// Cancel event channel subscription
_eventChannelSubscription?.cancel();
_eventChannelSubscription = null;
// Then close stream controllers
_streamControllerDurationState.close();
_streamControllerDownloadState.close();
_streamControllerPlaybackState.close();
_streamControllerProgressDownloadState.close();
}