dispose method

  1. @override
void dispose()
override

Calling this will stop the player, it will dispose player in native and also dispose the the controller.

As there is common stream for every players, stream will be still active without any events. To dispose it call stopAllPlayers.

Only calling dispose() will not stop the stream calling stopAllPlayers is still required.

Implementation

@override
void dispose() async {
  if (playerState != PlayerState.stopped) await stopPlayer();
  PlatformStreams.instance.playerControllerFactory.remove(this);
  super.dispose();
}