removeCallbacks method

void removeCallbacks()

Remove callbacks from this Audio.

This is useful when audio playback outlasts the lifespan of its parent object. If the Audio object has callbacks which retain the surrounding parent object, it will keep that parent object alive until it is finished playback (even after a call to dispose). This may not be desired, particularly if the callbacks are used just to update the parent object (i.e. they call setState() on a State object). Calling removeCallbacks on the parent object (e.g. in a State.dispose()) will break that reference.

Implementation

void removeCallbacks() {
  _onComplete = null;
  _awaitingOnCompleteAudios.remove(_audioId);
  _onDuration = null;
  _awaitingOnDurationAudios.remove(_audioId);
  _onPosition = null;
  _usingOnPositionAudios.remove(_audioId);
}