toDouble static method

double? toDouble(
  1. dynamic s
)

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

Implementation

static 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;
  }
}