isDouble method

bool isDouble()

Checks if the String value is convertible to a double.

Returns true if the string can be parsed as a valid double. Otherwise, returns false.

Example:

String? numberStr = "123.45";
print(numberStr.isDouble()); // true
String? invalidNumberStr = "abc";
print(invalidNumberStr.isDouble()); // false

Implementation

bool isDouble() => isEmptyOrNull ? false : double.tryParse(this!) != null;