asDigit method

int? asDigit(
  1. String char
)

Turn char into a number representing a digit, or null if it doesn't represent a digit in this locale.

Implementation

int? asDigit(String char) {
  var charCode = char.codeUnitAt(0);
  var digitValue = charCode - _localeZero;
  if (digitValue >= 0 && digitValue < 10) {
    return digitValue;
  } else {
    return null;
  }
}