Package io.flutter.embedding.engine.systemchannels

# Class ProcessTextChannel

java.lang.Object
io.flutter.embedding.engine.systemchannels.ProcessTextChannel

public class ProcessTextChannel extends Object
`ProcessTextChannel` is a platform channel that is used by the framework to initiate text processing feature in the embedding and for the embedding to send back the results.

When the framework needs to query the list of text processing actions (for instance to expose them in the selected text context menu), it will send to the embedding the message `ProcessText.queryTextActions`. In response, the `ProcessTextPlugin` will return a map of all activities that can process text. The map keys are generated IDs and the values are the activities labels. On the first request, the `ProcessTextPlugin` will make a call to Android's package manager to query all activities that can be performed for the `Intent.ACTION_PROCESS_TEXT` intent.

When a text processing action has to be executed, the framework will send to the embedding the message `ProcessText.processTextAction` with the `int id` of the choosen text action and the `String` of text to process as arguments. In response, the `ProcessTextPlugin` will make a call to the Android application activity to start the activity exposing the text action. The `ProcessTextPlugin` will return the processed text if there is one, or null if the activity did not return a transformed text.

`ProcessTextPlugin` implements `ProcessTextChannel.ProcessTextMethodHandler` that parses incoming messages from Flutter.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `ProcessTextChannel.ProcessTextMethodHandler`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final MethodChannel`
  `channel`
  `final PackageManager`
  `packageManager`
  `final MethodChannel.MethodCallHandler`
  `parsingMethodHandler`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ProcessTextChannel(DartExecutor dartExecutor, PackageManager packageManager)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `setMethodHandler(ProcessTextChannel.ProcessTextMethodHandler processTextMethodHandler)`
  Sets the `ProcessTextChannel.ProcessTextMethodHandler` which receives all requests to the text processing feature sent through this channel.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### channel

    public final MethodChannel channel

  - ### packageManager

    public final PackageManager packageManager

  - ### parsingMethodHandler

    @NonNull public final MethodChannel.MethodCallHandler parsingMethodHandler

- ## Constructor Details

  - ### ProcessTextChannel

    public ProcessTextChannel(@NonNull DartExecutor dartExecutor, @NonNull PackageManager packageManager)

- ## Method Details

  - ### setMethodHandler

    public void setMethodHandler(@Nullable ProcessTextChannel.ProcessTextMethodHandler processTextMethodHandler)
    Sets the `ProcessTextChannel.ProcessTextMethodHandler` which receives all requests to the text processing feature sent through this channel.