Source
int get last { if (string.length == 0) { throw new StateError('No elements.'); } int length = string.length; int code = string.codeUnitAt(length - 1); if (_isTrailSurrogate(code) && string.length > 1) { int previousCode = string.codeUnitAt(length - 2); if (_isLeadSurrogate(previousCode)) { return _combineSurrogatePair(previousCode, code); } } return code; }