Tsallaka zuwa abun ciki
Justice Tech School

Dart Input and Output

print writes a line. For input, import dart:io and use stdin.readLineSync(), which returns a nullable String.

Example
import 'dart:io';
void main() {
  stdout.write("Name: ");
  String? name = stdin.readLineSync();
  print("Hello ${name ?? "friend"}");
}

Exercise

Read a line.

stdin.()

Quiz Test

Which package holds stdin?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.