start method

void start()

Starts the spinner animation.

Implementation

void start() {
  if (!stdout.hasTerminal) {
    stdout.writeln('$message...');
    return;
  }
  stdout.write('\x1B[?25l'); // Hide cursor
  stdout.write('⠋ $message');
  _timer = Timer.periodic(const Duration(milliseconds: 80), (timer) {
    stdout.write('\r${_frames[_index % _frames.length]} $message');
    _index++;
  });
}