dynamicToDouble static method

double? dynamicToDouble(
  1. dynamic value
)

Implementation

static double? dynamicToDouble(dynamic value) {
  if (value == null) return null;
  if (value is double) return value;
  if (value is int) return value.toDouble();
  if (value is String && value.isNotEmpty) {
    return double.tryParse(value.removeAllNotNumber(exclude: [".", "-"]));
  }
  return null;
}