toDouble function

double toDouble(
  1. dynamic v
)

Return double from dynamic.

Use this to transform a string into double.

Implementation

double toDouble(dynamic v) {
  if (v == null) {
    return 0;
  } else if (v is int) {
    return v.toDouble();
  } else if (v is String) {
    return double.parse(v);
  } else {
    return v;
  }
}