strToFloat static method

double strToFloat(
  1. String str, [
  2. double defaultValue = defaultDouble
])

Implementation

static double strToFloat(String str, [double defaultValue = defaultDouble]) {
  if (str.isEmpty) return 0;
  try {
    return double.parse(str);
  } catch (e) {
    return defaultValue;
  }
}