onPop method

  1. @override
void onPop(
  1. double? fadeLength
)
override

What should happen when this level is popped from a level stack.

Implementation

@override
void onPop(final double? fadeLength) {
  super.onPop(fadeLength);
  final sound = _sound;
  if (sound != null) {
    if (fadeLength == null) {
      sound.destroy();
    } else {
      game.callAfter(
        runAfter: (fadeLength * 1000).round(),
        func: sound.destroy,
      );
    }
  }
  _sound = null;
}