Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where to get the user input in vs code? using dart

I am building a dart program to get the user input. when running the program using the run button I get the output in the output window but I cannot type in it. tried using the terminal to run the program and it worked well. so I want to know what is the right way to take the input from the user?

import 'dart:io';

void main() {
  print("enter your name: ");
  var name = stdin.readLineSync();

  print("hello mrs ${name}");
}

like image 562
Noha derwa Avatar asked Jan 25 '26 08:01

Noha derwa


1 Answers

From file -> Preferences -> Settings search for "Dart: Cli Console" Dart: Cli Console

Then change the drop-down menu into -terminal- now you can run again your code and check you can type in the terminal and your code will work.

like image 54
Shareef Al-Hakimi Avatar answered Jan 26 '26 23:01

Shareef Al-Hakimi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!