📜  如何在 dart 中使用 $ 输入作为字符串 - Dart 代码示例

📅  最后修改于: 2022-03-11 14:48:05.529000             🧑  作者: Mango

代码示例2
// Importing dart:io file
import 'dart:io';
 
void main()
{
    // Asking for favourite number
    print("Enter your favourite number:");
 
   // Scanning number
    int? n = int.parse(stdin.readLineSync()!);
   // Here ? and ! are for null safety
 
    // Printing that number
    print("Your favourite number is $n");
}