-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Description
Use case
Currently, it's very hard for Flutter developers to make changes to Flutter's text input experience without losing access to Flutter's entire text input stack. Specifically, if I want to [example]
This problem arises because in each of Flutter's platform embedders, Flutter abstracts differences in the platforms' text input APIs and communicates with the framework using common platform channel methods (text_input.dart). For Flutter app developers, there is no access to the platform's unique nuances if they aren't covered in the common platform channel methods. It's not possible to access them by writing a plugin without rewriting all the rest of Flutter's text input code as well.
Proposal
Instead of abstracting platform differences in the engine, the platform channel calls could mirror the native platform APIs. Any abstraction could be done in the framework, on top of these verbatim platform channel methods. Then, Flutter app developers could potentially access these calls themselves while still using Flutter's existing text editing stack.
Open questions
- Would it be possible to do this with FFI, or even FFIgen?
- Flutter suffers from a distributed system problem in that the framework and engine both maintain a copy of the current text input state, both sides can make changes to this, and it must be synced between them asynchronously. Does this new approach make this problem worse or better?
Creating this issue in collaboration with @matthew-carroll from a discussion in #150068.