@override int toDigit(String ch) { if (ch.codeUnitAt(0) >= '0'.codeUnitAt(0) && ch.codeUnitAt(0) <= '9'.codeUnitAt(0)) { return ch.codeUnitAt(0) - 48; } throw AssertionError('Not valid digit: ' + ch); }