runeAt method

int runeAt(
  1. int index
)

Implementation

@pragma('vm:prefer-inline')
@pragma('dart2js:tryInline')
// ignore: unused_element
int runeAt(int index) {
  final w1 = codeUnitAt(index++);
  if (w1 > 0xd7ff && w1 < 0xe000) {
    if (index < length) {
      final w2 = codeUnitAt(index);
      if ((w2 & 0xfc00) == 0xdc00) {
        return 0x10000 + ((w1 & 0x3ff) << 10) + (w2 & 0x3ff);
      }
    }

    throw FormatException('Invalid UTF-16 character', this, index - 1);
  }

  return w1;
}