toDouble function

double? toDouble(
  1. dynamic s
)

If a value (typically a String) is numeric return as a double

Implementation

double? toDouble(dynamic s) {
  try {
    if (isNullOrEmpty(s)) return null;
    if (s is double) return s;
    if (s is String) return double.parse(s);
    return toDouble(s.toString());
  } catch (e) {
    return null;
  }
}