toDouble method

double toDouble({
  1. double def = 0,
})

Try to parse to double, fallback to def

Implementation

double toDouble({double def = 0}) {
  if (this == null) return def;
  return double.tryParse(toString()) ?? def;
}