| 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
_VoidPtr | userData

## Detailed Description

Definition at line 14 of file FlutterEmbedderKeyResponderTest.mm.

## Method Documentation

## ◆ hasCallback

- (BOOL) hasCallback |  |  |

Definition at line 42 of file FlutterEmbedderKeyResponderTest.mm.

42 {
43 return _callback != nil;
44 }

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

## ◆ initWithEvent:callback:userData:

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

Definition at line 26 of file FlutterEmbedderKeyResponderTest.mm.

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

References callback, and userData.

## ◆ respond:

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

Definition at line 46 of file FlutterEmbedderKeyResponderTest.mm.

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

## Property Documentation

## ◆ callback

- (FlutterKeyEventCallback) callback
| read write nonatomic assign

Definition at line 16 of file FlutterEmbedderKeyResponderTest.mm.

Referenced by initWithEvent:callback:userData:.

## ◆ data

- (FlutterKeyEvent*) data
| read write nonatomic assign

Definition at line 15 of file FlutterEmbedderKeyResponderTest.mm.

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

## ◆ userData

- (_VoidPtr) userData
| read write nonatomic assign

Definition at line 17 of file FlutterEmbedderKeyResponderTest.mm.

Referenced by initWithEvent:callback:userData:.

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

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

TestKeyEvent::callback
FlutterKeyEventCallback callback
Definition: FlutterEmbedderKeyResponderTest.mm:16
TestKeyEvent::userData
_VoidPtr userData
Definition: FlutterEmbedderKeyResponderTest.mm:17