isStringNumber function
Returns true
if str
represents a valid number, false
otherwise.
This function attempts to parse the input string as a double using
the double.tryParse method. If the conversion succeeds, the function
returns true
. Otherwise, it returns false
.
Implementation
bool isStringNumber(String str) {
final doubleValue = double.tryParse(str);
return doubleValue != null;
}