flutter / flutter/flutter

Expose low level IME interactions

Open
#150,460 9 comments 31 reactions 0 assignees View on GitHub
a: text input c: proposal P2 team-text-input triaged-text-input
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

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](https://github.com/flutter/flutter/blob/b44c67e2e8/packages/flutter/lib/src/services/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 https://github.com/flutter/flutter/issues/150068.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.