dispose method
Release all resources associated with this player. You must invoke this after you are done with the player.
Implementation
Future<void> dispose() async {
if (_disposed) return;
_disposed = true;
if (_nativePlatform != null) {
await _disposePlatform(await _nativePlatform!);
_nativePlatform = null;
}
if (_idlePlatform != null) {
await _disposePlatform(_idlePlatform!);
_idlePlatform = null;
}
_audioSource = null;
for (var s in _audioSources.values) {
s._dispose();
}
_audioSources.clear();
_proxy.stop();
await _durationSubject.close();
await _loopModeSubject.close();
await _shuffleModeEnabledSubject.close();
await _playingSubject.close();
await _volumeSubject.close();
await _speedSubject.close();
await _pitchSubject.close();
await _sequenceSubject.close();
await _shuffleIndicesSubject.close();
}