tryParseToDoubleValue property

  1. @Doc(message: '将一个dynamic的值尝试转换成double类型,如果转换失败了, 则返回null')
double? tryParseToDoubleValue

Implementation

@Doc(message: '将一个dynamic的值尝试转换成double类型,如果转换失败了, 则返回null')
double? get tryParseToDoubleValue {
  switch (runtimeType) {
    case double:
      return this as double;
    case int:
      return asInt.toDouble();
    default:
      return double.tryParse(asString);
  }
}