In use process, the android native part can invoke methods:
@ Override
Public Boolean onKeyDown (int keyCode, KeyEvent event) {
If (keyCode==139 | | keyCode==280 | | keyCode==293) {
If (event. GetRepeatCount ()==0) {
The v (" qluerp tigger ", "clicked");
MethodChannel. InvokeMethod (" triggerClicked ", null);
}
return true;
}
Return super. OnKeyDown (keyCode, event);
}
@ Override
Public Boolean onKeyUp (int keyCode, KeyEvent event) {
If (keyCode==139 | | keyCode==280) {
If (event. GetRepeatCount ()==0) {
//barcode2DWithSoft stopScan ();
MethodChannel. InvokeMethod (" triggerClickedup ", null);
return true;
}
}
Return super. OnKeyUp (keyCode, event);
}
Whether to listen to a handheld device, click on the button but we were using the flutter in the development process will minimize the use of flutter language part, so how do we in the code of flutter also can listen to the button is clicked?