isDecimal function

bool isDecimal(
  1. String str
)

Checks if the string represents a decimal number.

Accepts an optional sign followed by digits with an optional fractional part (e.g. 1, -1.5, .5, +10.0).

Example:

isDecimal('1.5'); // true
isDecimal('-0.25'); // true
isDecimal('.5'); // true
isDecimal('1.'); // false
isDecimal('abc'); // false

Implementation

bool isDecimal(String str) => _isDecimal(str);