toDouble method

double toDouble({
  1. double defaultValue = 0.0,
})

Converts the string to a double with a default value if conversion fails.

Implementation

double toDouble({double defaultValue = 0.0}) {
  try {
    return double.parse(this);
  } catch (_) {
    return defaultValue;
  }
}