Package io.flutter.embedding.android

# Class KeyData

java.lang.Object
io.flutter.embedding.android.KeyData

public class KeyData extends Object
The resulting Flutter key events generated by `KeyEmbedderResponder`, and are sent through the messenger after being marshalled with `toBytes()`.

This class is the Java adaption of `KeyData` and `KeyDataPacket` in the C engine. Changes made to either side must also be made to the other.

Each `KeyData` corresponds to a `ui.KeyData` in the framework.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `KeyData.DeviceType`
  The device type of the key data.
  `static enum`
  `KeyData.Type`
  The action type of the key data.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `CHANNEL`
  The channel that key data should be sent through.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `KeyData()`
  Creates an empty `KeyData`.
  `KeyData(ByteBuffer buffer)`
  Unmarshal fields from a buffer.

- ## Method Summary

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

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

- ## Field Details

  - ### CHANNEL

    public static final String CHANNEL
    The channel that key data should be sent through.

    Must be kept in sync with kFlutterKeyDataChannel in embedder.cc

    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### KeyData

    public KeyData()
    Creates an empty `KeyData`.

  - ### KeyData

    public KeyData(@NonNull ByteBuffer buffer)
    Unmarshal fields from a buffer.

    For the binary format, see `lib/ui/window/key_data_packet.h`.