Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | List of all members
io.flutter.embedding.engine.systemchannels.KeyboardChannel Class Reference

Classes

interface  KeyboardMethodHandler
 

Public Member Functions

 KeyboardChannel (@NonNull BinaryMessenger messenger)
 
void setKeyboardMethodHandler (@Nullable KeyboardMethodHandler keyboardMethodHandler)
 

Public Attributes

final MethodChannel channel
 
final MethodChannel.MethodCallHandler parsingMethodHandler
 

Detailed Description

Event message channel for keyboard events to/from the Flutter framework.

Receives asynchronous messages from the framework to query the engine known pressed state.

Definition at line 21 of file KeyboardChannel.java.

Constructor & Destructor Documentation

◆ KeyboardChannel()

io.flutter.embedding.engine.systemchannels.KeyboardChannel.KeyboardChannel ( @NonNull BinaryMessenger  messenger)
inline

Definition at line 54 of file KeyboardChannel.java.

54 {
55 channel = new MethodChannel(messenger, "flutter/keyboard", StandardMethodCodec.INSTANCE);
56 channel.setMethodCallHandler(parsingMethodHandler);
57 }
final MethodChannel.MethodCallHandler parsingMethodHandler

Member Function Documentation

◆ setKeyboardMethodHandler()

void io.flutter.embedding.engine.systemchannels.KeyboardChannel.setKeyboardMethodHandler ( @Nullable KeyboardMethodHandler  keyboardMethodHandler)
inline

Sets the KeyboardMethodHandler which receives all requests to query the keyboard state.

Definition at line 62 of file KeyboardChannel.java.

62 {
63 this.keyboardMethodHandler = keyboardMethodHandler;
64 }

Member Data Documentation

◆ channel

final MethodChannel io.flutter.embedding.engine.systemchannels.KeyboardChannel.channel

Definition at line 22 of file KeyboardChannel.java.

◆ parsingMethodHandler

final MethodChannel.MethodCallHandler io.flutter.embedding.engine.systemchannels.KeyboardChannel.parsingMethodHandler
Initial value:
=
new MethodChannel.MethodCallHandler() {
Map<Long, Long> pressedState = new HashMap<>();
@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
if (keyboardMethodHandler == null) {
result.success(pressedState);
} else {
switch (call.method) {
case "getKeyboardState":
try {
pressedState = keyboardMethodHandler.getKeyboardState();
} catch (IllegalStateException exception) {
result.error("error", exception.getMessage(), null);
}
result.success(pressedState);
break;
default:
result.notImplemented();
break;
}
}
}
}
static ::testing::Matcher< GBytes * > MethodCall(const std::string &name, ::testing::Matcher< FlValue * > args)
GAsyncResult * result

Definition at line 26 of file KeyboardChannel.java.

27 {
28 Map<Long, Long> pressedState = new HashMap<>();
29
30 @Override
31 public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
32 if (keyboardMethodHandler == null) {
33 // Returns an empty pressed state when the engine did not get a chance to register
34 // a method handler for this channel.
35 result.success(pressedState);
36 } else {
37 switch (call.method) {
38 case "getKeyboardState":
39 try {
40 pressedState = keyboardMethodHandler.getKeyboardState();
41 } catch (IllegalStateException exception) {
42 result.error("error", exception.getMessage(), null);
43 }
44 result.success(pressedState);
45 break;
46 default:
47 result.notImplemented();
48 break;
49 }
50 }
51 }
52 };
call(args)
Definition dom.py:159

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