Search code examples
flutterdartflutter-dependenciesmedia-player

How to dispose() the better_player when initialization


When opening a new page, the player continues to play this happens when I open another page at the moment the player is initializing

Tried to dispose

  • when the focus on the widget disappeared
  • when the button was pressed
  • when the screen goes out of view

none of this helps


Solution

  • Solution. At the moment the player is initialized, I block the route, after initialization I remove the lock and then you can go to another page by deleting the player.