在VS studio中使用stdin,并且从不返回任何数据-Flutter



导入'dart:io';void main(({print("something h"(;字符串x=stdin.readLineSync((!;print('maher$x'(;}

Dart脚本在;调试控制台";默认情况下,输入框用作REPL。如果需要读取用户的输入,则需要将其更改为在终端中运行。

您可以通过创建一个launch.json文件并添加"console": "terminal",来完成此操作,如下所述:

https://dartcode.org/docs/running-in-terminal/

或者,您可以在此项目的VS代码工作区设置中添加"dart.cliConsole": "terminal"设置。

最新更新