You can do that in different ways:
Read moreHow do you take input from Dartpad?
“how to take input from user in dart using dartpad” Code Answer
Read moreHow do you get a dart input?
How to take input in Dart. To take input from a user in Dart, you need to import the dart:io library . The input is taken through the console using the . readLineSync() function.
Read moreHow do you add an if else condition in flutter?
Ways to Use If Else Statement in Flutter Widget
Read moreHow do you use a conditional statement within a child attribute of a flutter widget?
How to use Conditional Statement (IF ELSE) on Child Widget in…
Read moreHow do you use if else?
Conditional Statements
Read moreHow do you write a Dart function?
Dart Function with parameter and return value
Read more