toDouble property

double? get toDouble

Converts a String todouble if possible.

If conversion fails, null is returned.

Example

String foo = '4';
int fooInt = foo.toDouble(); // returns 4.0;
String foo = '4f';
var fooNull = foo.toDouble(); // returns null;

Implementation

double? get toDouble {
  if (isBlank) {
    return null;
  }

  return double.tryParse(this);
}