toFloat function

double toFloat(
  1. String str
)

convert the input to a float, or NAN if the input is not a float

Implementation

double toFloat(String str) {
  try {
    return double.parse(str);
  } on FormatException {
    return double.nan;
  }
}