numeric method

num? numeric()

Returns double 0.564 from string percentage like "56.4%" Parse source as a double literal and return its value.

Implementation

num? numeric() {
  if (this == null) {
    return null;
  }
  if (_percentageRegex.hasMatch(this!)) {
    return num.parse(this!.substring(0, this!.length - 1)) / 100;
  }
  if (_permilleRegex.hasMatch(this!)) {
    return num.parse(this!.substring(0, this!.length - 1)) / 1000;
  }
  if (_permyriadRegex.hasMatch(this!)) {
    return num.parse(this!.substring(0, this!.length - 1)) / 10000;
  }
  return num.tryParse(this!);
}