I was trying to take integer as input in Dart using the following as it is suggested in many sources.
import 'dart:io';
void main() {
int n = int.parse(stdin.readLineSync());
}
But the following error message was shown when I tried to run (Visual Studio Code was also showing it in problems):
Error: The argument type 'String?' can't be assigned to the parameter type 'String' because 'String?' is nullable and 'String' isn't.
Now how can I take a integer or double as input? (I'm using Dart SDK version: 2.12.2 (stable))