title: Check if Stateless widget is disposed in flutter
body: <p>When my stateless widget built I play some sounds in sequence order by using this code:</p>
  
  <pre><code>await _audioPlayer.play(contentPath1, isLocal: true);
  await Future.delayed(Duration(seconds: 4));
  await _audioPlayer.play(contentPath2, isLocal: true);
  await Future.delayed(Duration(seconds: 4));
  await _audioPlayer.play(contentPath3, isLocal: true);
  </code></pre>
  
  <p>when the user closes the current widget before finish playing the sounds, The sounds still work even after closing the current route by using this code:</p>
  
  <pre><code>Navigator.pop(context);
  </code></pre>
  
  <p>my workaround is to use a boolean variable to indicate if the closing action has done.</p>
  
  <p>Playing sound code:</p>
  
  <pre><code>await _audioPlayer.play(contentPath1, isLocal: true);
  if (closed) return;
  await Future.delayed(Duration(seconds: 4));
  if (closed) return;
  await _audioPlayer.play(contentPath2, isLocal: true);
  if (closed) return;
  await Future.delayed(Duration(seconds: 4));
  if (closed) return;
  await _audioPlayer.play(contentPath3, isLocal: true);
  </code></pre>
  
  <p>Closing the current widget:</p>
  
  <pre><code>closed = true;
  _audioPlayer.stop();
  </code></pre>
  
  <p>Are there a better way to stop the async methods if my widget closed?</p>