How to take input from user
Jeet Bhalu
1 min read
input user:
in Dart, you can take input from the user using the stdin
stream from the dart:io
library.
import 'dart:io';
void main() {
// Prompt the user for input
print('Enter your name: ');
// Read the input from the user
String? userInput = stdin.readLineSync();
// Display the input
print('Hello, $userInput!');
}
- We import the
dart:io
library to access the standard input/output streams.
0
Subscribe to my newsletter
Read articles from Jeet Bhalu directly inside your inbox. Subscribe to the newsletter, and don't miss out.
How to take input from userDart#dart language#dart-for-beginnersdart programming tutorial#dart-keywordsinput output
Written by
Jeet Bhalu
Jeet Bhalu
i am Jeet Bhalu i am flutter App developer