check string is digit dart code example
Example 1: flutter check if string is number
bool isNumeric(String s) {
if (s == null) {
return false;
}
return double.tryParse(s) != null;
}
Example 2: check only digits in dart
bool isNumeric(String s) {
if (s == null) {
return false;
}
return double.tryParse(s) != null;
}