Suggest the Characters API when completing callbacks for handling user-generated text #41677
Labels
area-devexp
For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.
devexp-completion
Issues with the analysis server's code completion feature
devexp-server
Issues related to some aspect of the analysis server
P3
A lower priority bug or feature request
type-enhancement
A request for a change that isn't a bug
This is a feature request for the Dart Analyzer to augment its current completion behavior for certain known callbacks in Flutter that handle user-generated text (e.g., https://api.flutter.dev/flutter/material/TextField/onChanged.html).
Background
The characters package was recently introduced to address Dart String's limitations of manipulating extended grapheme clusters (dart-lang/language#34). However, it requires the user to get out of their way to look for it and add it to their projects. This barrier is likely to cause continued use of the String API in cases where the characters package ought to be used to avoid breaking emojis and non-English text.
Request
As part of a larger plan to make the Characters API more discoverable when writing text manipulation code, the Dart Analyzer could suggest the API when autocompleting the callback template for handling user entered text. For example everything in this snippet after the user autocompletes on
onChanged
can potentially be populated for them:This request, if accepted, depends on exposing the Characters package in Flutter's public API as tracked here: flutter/flutter#55593.
The text was updated successfully, but these errors were encountered: