show method

Future<void> show(
  1. List<LevelUpCelebration> celebrations, {
  2. VoidCallback? onComplete,
})

Starts the celebration sequence for celebrations, shown in list order (already-ascending, since that's how PlayerProgressionService.grantXp fires them). Starting a new show while a previous one is still running supersedes it — the old one's onComplete is dropped, never called.

onComplete fires exactly once: after the LAST queued celebration's LevelUpPhase.rewardReveal finishes, or immediately if celebrations is empty. It never fires twice, including when skip cuts the sequence short.

Implementation

Future<void> show(
  List<LevelUpCelebration> celebrations, {
  VoidCallback? onComplete,
}) async {
  if (_disposed) return;
  if (celebrations.isEmpty) {
    onComplete?.call();
    return;
  }

  final token = ++_tokenCounter;
  _activeToken = token;
  _queue = celebrations;
  _onComplete = onComplete;
  queueIndex.value = 0;
  await _runCurrent(token);
}