Digit.char constructor

Digit.char(
  1. String digitChar
)

Constructs a digit from the character representing the digit.

Implementation

factory Digit.char(String digitChar) {
  if (digitChar.length != 1) {
    throw Exception('Digit must be constructed with a single character');
  }
  return Digit(digitChar.codeUnitAt(0) - codeUnit0);
}