getApiDoubleOrDefault method

double? getApiDoubleOrDefault(
  1. K key, {
  2. double? defaultValue,
  3. List<K> alternativeKeys = const [],
  4. bool smartRound = false,
  5. int maxPrecision = 2,
})

Implementation

double? getApiDoubleOrDefault(
  K key, {
  double? defaultValue,
  List<K> alternativeKeys = const [],
  bool smartRound = false,
  int maxPrecision = 2,
}) {
  final parsed = _parseDouble(_valueFor(key, alternativeKeys), defaultValue);
  if (parsed == null) return defaultValue;
  if (!smartRound) return parsed;
  return parsed.toNumAsSmartRound(maxPrecision: maxPrecision).toDouble();
}