2
  1. What methods are there to move the cursor in a command line app?
  2. I've tried simpler things, such as using "\b", but that didn't work:

    print("test\ba");

    I expected the output tesa but I get testa (\b was ignored).

Update

Regarding (2), that was the output in the webstorm IDE, however it worked fine in the normal OS X Terminal.

Alon Amir
  • 4,913
  • 9
  • 47
  • 86

1 Answers1

1

On Linux or OSX you can use ANSI sequences https://en.wikipedia.org/wiki/ANSI_escape_code. On Windows you are pretty much out of luck AFAIK. Take a look at https://pub.dartlang.org/packages/ansicolor for an example how to use ANSI codes.

See also this similar question Clearing the terminal screen in a command-line Dart app

Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567