How do I read console input from stdin in Dart?
stdin
Is there a scanf in Dart?
scanf
The readLineSync() method of stdin allows to capture a String from the console:
import 'dart:io'; main() { print('1 + 1 = ...'); var line = stdin.readLineSync(encoding: Encoding.getByName('utf-8')); print(line.trim() == '2' ? 'Yup!' : 'Nope :('); }