Fix emoji insertion corruption by using grapheme-aware text operations by Istiak-Ahmed78 · Pull Request #183112 · flutter/flutter

@Istiak-Ahmed78

- Update TextEditingValue.replaced() to use grapheme cluster boundaries
  instead of UTF-16 code unit positions to prevent splitting surrogate pairs
- Add TextInput._validateAndCorrectTextEditingValue() to detect and fix
  broken surrogate pairs received from the Android IME
- Intercept platform text updates in _handleTextInputInvocation() to apply
  corrections before updating the text input client

Fixes flutter#181759

@github-actions bot added a: text input

Entering text in a text field or keyboard related problems

framework

flutter/packages/flutter repository. See also f: labels.

labels

Mar 2, 2026

@Istiak-Ahmed78

gemini-code-assist[bot]

Istiak-Ahmed78