getJsonDoubleNumber function

double getJsonDoubleNumber(
  1. double? value, [
  2. double defaultValue = 0.0
])

获取json格式下的double number, 如果当前number的值为null或nan,就返回默认值 或 0.0

Implementation

double getJsonDoubleNumber(double? value, [double defaultValue = 0.0]) {
  var isNaN = value != null && value.isNaN;
  if (isNaN || value == null) {
    return defaultValue;
  }

  return value;
}