tryCastToDouble method

double? tryCastToDouble()

Implementation

double? tryCastToDouble() {
  if (this == null) {
    return null;
  }
  if (this is num) {
    return (this as num).toDouble();
  }
  if (this is double) {
    return this as double;
  }
  return double.tryParse(this.toString().trim());
}