| Flutter iOS Embedder |

Instance Methods | Properties | List of all members
FlutterEmbedderKeyResponder() Category Reference

## Instance Methods
(void) | - synchronizeModifiers:
(void) | - updateKey:asPressed:
(void) | - synthesizeCapsLockTapWithTimestamp:
(void) | - sendPrimaryFlutterEvent:callback:
(void) | - sendEmptyEvent
(void) | - synthesizeModifierEventOfType:timestamp:keyCode:
(void) | - handlePressBegin:callback:
(void) | - handlePressEnd:callback:
(void) | - handleResponse:forId:
(UInt32) | - fixSidedFlags:withLeftFlag:withRightFlag:withLeftKey:withRightKey:withKeyCode:keyDown:forFlags:
(UInt32) | - adjustModifiers:

## Properties
FlutterSendKeyEvent | sendEvent
NSMutableDictionary< NSNumber *, NSNumber * > * | pressingRecords
NSUInteger | modifierFlagOfInterestMask
NSUInteger | lastModifierFlagsOfInterest
uint64_t | responseId
NSMutableDictionary< NSNumber *, FlutterAsyncKeyCallback > * | pendingResponses

## Detailed Description

Definition at line 350 of file FlutterEmbedderKeyResponder.mm.

## Method Documentation

## ◆ adjustModifiers:

- (UInt32) adjustModifiers: |  | (ios(13.4)) | API_AVAILABLE |

Because iOS differs from other platforms in that the modifier flags still contain the flag for the key that is being released on the keyup event, we adjust the modifiers when the released key is a matching modifier key.

## ◆ fixSidedFlags:withLeftFlag:withRightFlag:withLeftKey:withRightKey:withKeyCode:keyDown:forFlags:

- (UInt32) fixSidedFlags: |  | (ModifierFlag) | anyFlag
withLeftFlag: |  | (ModifierFlag) | leftSide
withRightFlag: |  | (ModifierFlag) | rightSide
withLeftKey: |  | (UInt16) | leftKeyCode
withRightKey: |  | (UInt16) | rightKeyCode
withKeyCode: |  | (UInt16) | keyCode
keyDown: |  | (BOOL) | isKeyDown
forFlags: |  | (ios(13.4)) | API_AVAILABLE

Fix up the modifiers for a particular type of modifier key.

## ◆ handlePressBegin:callback:

- (void) handlePressBegin: |  | (nonnull FlutterUIPressProxy *) | press
callback: |  | (ios(13.4)) | API_AVAILABLE

Processes a down event from the system.

## ◆ handlePressEnd:callback:

- (void) handlePressEnd: |  | (nonnull FlutterUIPressProxy *) | press
callback: |  | (ios(13.4)) | API_AVAILABLE

Processes an up event from the system.

## ◆ handleResponse:forId:

- (void) handleResponse: |  | (BOOL) | handled
forId: |  | (uint64_t) | responseId

Processes the response from the framework.

## ◆ sendEmptyEvent

- (void) sendEmptyEvent |  |  |

Send an empty key event.

The event is never synthesized, and never expects an event result. An empty event is sent when no other events should be sent, such as upon back-to-back keydown events of the same key.

## ◆ sendPrimaryFlutterEvent:callback:

- (void) sendPrimaryFlutterEvent: |  | (const FlutterKeyEvent &) | event
callback: |  | (nonnull FlutterKeyCallbackGuard *) | callback

Send an event to the framework, expecting its response.

## ◆ synchronizeModifiers:

- (void) synchronizeModifiers: |  | (ios(13.4)) | API_AVAILABLE |

Compare the last modifier flags and the current, and dispatch synthesized key events for each different modifier flag bit.

The flags compared are all flags after masking with |modifierFlagOfInterestMask| and excluding |ignoringFlags|.

## ◆ synthesizeCapsLockTapWithTimestamp:

- (void) synthesizeCapsLockTapWithTimestamp: |  | (NSTimeInterval) | timestamp |

Synthesize a CapsLock down event, then a CapsLock up event.

## ◆ synthesizeModifierEventOfType:timestamp:keyCode:

- (void) synthesizeModifierEventOfType: |  | (BOOL) | isDownEvent
timestamp: |  | (NSTimeInterval) | timestamp
keyCode: |  | (UInt32) | keyCode

Send a key event for a modifier key.

## ◆ updateKey:asPressed:

- (void) updateKey: |  | (uint64_t) | physicalKey
asPressed: |  | (uint64_t) | logicalKey

Update the pressing state.

If `logicalKey` is not 0, `physicalKey` is pressed as `logicalKey`. Otherwise, `physicalKey` is released.

## Property Documentation

## ◆ lastModifierFlagsOfInterest

- (NSUInteger) lastModifierFlagsOfInterest
| readwritenonatomicassign

The modifier flags of the last received key event, excluding uninterested bits.

This should be kept synchronized with the last |NSEvent.modifierFlags| after masking with |modifierFlagOfInterestMask|. This should also be kept synchronized with the corresponding keys of |pressingRecords|.

This is used by |synchronizeModifiers| to quickly find out modifier keys that are desynchronized.

Definition at line 391 of file FlutterEmbedderKeyResponder.mm.

## ◆ modifierFlagOfInterestMask

- (NSUInteger) modifierFlagOfInterestMask
| readwritenonatomicassign

A constant mask for NSEvent.modifierFlags that Flutter synchronizes with.

Flutter keeps track of the last |modifierFlags| and compares it with the incoming one. Any bit within |modifierFlagOfInterestMask| that is different (except for the one that corresponds to the event key) indicates that an event for this modifier was missed, and Flutter synthesizes an event to make up for the state difference.

It is computed by computeModifierFlagOfInterestMask.

Definition at line 378 of file FlutterEmbedderKeyResponder.mm.

## ◆ pendingResponses

- (NSMutableDictionary<NSNumber*, FlutterAsyncKeyCallback>*) pendingResponses
| readnonatomiccopy

A map of unresponded key events sent to the framework.

Its values are |responseId|s, and keys are the callback that was received along with the event.

Definition at line 405 of file FlutterEmbedderKeyResponder.mm.

## ◆ pressingRecords

- (NSMutableDictionary<NSNumber*, NSNumber*>*) pressingRecords
| readnonatomiccopy

A map of pressed keys.

The keys of the dictionary are physical keys, while the values are the logical keys of the key down event.

Definition at line 365 of file FlutterEmbedderKeyResponder.mm.

## ◆ responseId

- (uint64_t) responseId
| readwritenonatomicassign

A self-incrementing ID used to label key events sent to the framework.

Definition at line 396 of file FlutterEmbedderKeyResponder.mm.

## ◆ sendEvent

- (FlutterSendKeyEvent) sendEvent
| readnonatomiccopy

The function to send converted events to.

Set by the initializer.

Definition at line 357 of file FlutterEmbedderKeyResponder.mm.

The documentation for this category was generated from the following file:

- shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponder.mm