getDouble static method

double getDouble(
  1. Map<String, dynamic>? uiConfig,
  2. String key,
  3. double defaultValue
)

Get a double value from uiConfig with a default

Implementation

static double getDouble(
  Map<String, dynamic>? uiConfig,
  String key,
  double defaultValue,
) {
  if (uiConfig == null) return defaultValue;
  final value = uiConfig[key];
  if (value == null) return defaultValue;
  if (value is double) return value;
  if (value is int) return value.toDouble();
  if (value is String) return double.tryParse(value) ?? defaultValue;
  return defaultValue;
}