toFloat function

double? toFloat(
  1. String str
)

Converts the string to a double.

Returns null if the string cannot be parsed.

Example:

toFloat('3.14'); // 3.14
toFloat('abc'); // null

Implementation

double? toFloat(String str) => double.tryParse(str.trim());