checkDouble static method

double? checkDouble(
  1. dynamic input,
  2. double? fallback
)

Implementation

static double? checkDouble(dynamic input, double? fallback) {
  switch (input.runtimeType) {
    case String:
      return double.tryParse(input) ?? fallback;
    case int:
      return input + .0;
    case double:
      return input;
    default:
      return fallback;
  }
}