isNumeric static method
Checks if string is a number by attempting to parse it
as a double.
INFINITY and NaN are not treated as numbers.
Implementation
static bool isNumeric(String? string) {
if (string == null) {
return false;
}
if (string == double.infinity.toString() ||
string == double.nan.toString()) {
return false;
}
return double.tryParse(string) != null;
}