How to read a string from console in Dart

1 Answer

0 votes
import 'dart:io';
 
void main() {
    print('Enter text: ');
  
    String str = stdin.readLineSync()!;
  
    print('str = $str');
}




/*
run:

Enter text: 
dart
str = dart

*/

 



answered Oct 12, 2022 by avibootz

Related questions

1 answer 136 views
2 answers 232 views
1 answer 154 views
1 answer 147 views
1 answer 172 views
...