stop method

void stop({
  1. String? completionMessage,
  2. bool success = true,
})

Stop the spinner with an optional completion message

Implementation

void stop({String? completionMessage, bool success = true}) {
  if (!_running) return;

  _timer?.cancel();
  _timer = null;
  _running = false;

  _clearPreviousLine();

  if (completionMessage != null) {
    final color = success ? '\x1B[32m' : '\x1B[31m';
    final symbol = success ? '✓' : '✗';
    stdout.write('\r$color$symbol\x1B[0m $completionMessage\n');
  }

  // Show cursor again
  stdout.write('\x1B[?25h');
}