| Flutter macOS Embedder |

Instance Methods | Properties | List of all members
TestKeyEvent Class Reference
Inheritance diagram for TestKeyEvent:

## Instance Methods
(nonnull instancetype) | - initWithEvent:callback:userData:
(BOOL) | - hasCallback
(void) | - respond:

## Properties
FlutterKeyEvent * | data
FlutterKeyEventCallback | callback
void * | userData

## Detailed Description

Definition at line 13 of file FlutterEmbedderKeyResponderTest.mm.

## Method Documentation

## ◆ hasCallback

- (BOOL) hasCallback |  |  |

Definition at line 16 of file FlutterEmbedderKeyResponderTest.mm.

41 {
42 return _callback != nil;
43 }

References callback, and userData.

Referenced by flutter::testing::TEST().

## ◆ initWithEvent:callback:userData:

- (instancetype) initWithEvent: |  | (const FlutterKeyEvent*) | event
callback: |  | (nullable FlutterKeyEventCallback) | callback
userData: |  | (nullable void*) | userData

Definition at line 16 of file FlutterEmbedderKeyResponderTest.mm.

25 :(const FlutterKeyEvent*)event
26 callback:(nullable FlutterKeyEventCallback)callback
27 userData:(nullable void*)userData {
28 self = [super init];
29 _data = new FlutterKeyEvent(*event);
30 if (event->character != nullptr) {
31 size_t len = strlen(event->character);
32 char* character = new char[len + 1];
33 strlcpy(character, event->character, sizeof(character));
34 _data->character = character;
35 }
36 _callback = callback;
37 _userData = userData;
38 return self;
39 }
TestKeyEvent::callback
FlutterKeyEventCallback callback
Definition: FlutterEmbedderKeyResponderTest.mm:15
TestKeyEvent::userData
void * userData
Definition: FlutterEmbedderKeyResponderTest.mm:16

## ◆ respond:

- (void) respond: |  | (BOOL) | handled |

Definition at line 16 of file FlutterEmbedderKeyResponderTest.mm.

45 :(BOOL)handled {
46 NSAssert(
47 _callback != nil,
48 @"Improper call to `respond` that does not have a callback."); // Caller's responsibility
49 _callback(handled, _userData);
50 }

## Property Documentation

## ◆ callback

- (FlutterKeyEventCallback) callback
| readwritenonatomicassign

Definition at line 15 of file FlutterEmbedderKeyResponderTest.mm.

Referenced by hasCallback.

## ◆ data

- (FlutterKeyEvent*) data
| readwritenonatomicassign

Definition at line 14 of file FlutterEmbedderKeyResponderTest.mm.

## ◆ userData

- (void*) userData
| readwritenonatomicassign

Definition at line 16 of file FlutterEmbedderKeyResponderTest.mm.

Referenced by hasCallback.

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

- shell/platform/darwin/macos/framework/Source/FlutterEmbedderKeyResponderTest.mm