Take this sample program:
import 'package:cli_repl/cli_repl.dart';
void main() async {
final repl = Repl(prompt: '> ');
await for (final answer in repl.runAsync()) {
if (answer == 'exit') break;
await Future(() => print("You said '$answer'"));
}
print("done");
await repl.exit();
}
When running this program, the You said x message is always printed after the prompt. This makes writing REPLs that evaluate commands async impossible even when the for-loop body awaits, as in this example.
The expected behaviour is to wait for the body to complete before printing the prompt.