parsePercentage static method

double? parsePercentage(
  1. String value
)

Implementation

static double? parsePercentage(String value) {
  if (_cachedParsedPercentage.containsKey(value)) {
    return _cachedParsedPercentage[value];
  }
  double? parsed;
  if (value.endsWith(percentageSymbol)) {
    final String raw = value.substring(0, value.length - 1);
    final double? n = double.tryParse(raw);
    if (n != null) parsed = n / 100;
  }
  return _cachedParsedPercentage[value] = parsed;
}