toDouble static method
Implementation
static double? toDouble(v, {double? defaultValue}) {
if (v == null) return defaultValue;
if (v is double) return v;
if (v is num) return v.toDouble();
if (v is String) return double.tryParse(v) ?? defaultValue;
if (defaultValue != null) return defaultValue;
throw Exception('Trying to convert a non-double to double!');
}