startReplay method

void startReplay([
  1. int? startIndex
])

Implementation

void startReplay([int? startIndex]) {
  _isReplayMode = true;
  final total = _candleBuilder.candles.length;
  final defaultIndex = total > 40 ? total - 40 : (total ~/ 2);
  _replayIndex = (startIndex ?? defaultIndex).clamp(
    1,
    math.max(1, total - 1),
  );
  _isReplaying = false;
  _replayTimer?.cancel();
  _recalculateIndicators();
  scrollToLatest();
  notifyListeners();
}