isNum method

bool isNum()

Checks if the string represents a numeric value.

Example:

print('2021'.isNum()); // true
print('3.14'.isNum()); // true
print('abc'.isNum()); // false

Implementation

bool isNum() => num.tryParse(this) != null;