onKeyData property Null safety

KeyDataCallback? onKeyData

A callback that is invoked when key data is available.

The framework invokes this callback in the same zone in which the callback was set.

The callback should return true if the key event has been handled by the framework and should not be propagated further.

Implementation

KeyDataCallback? get onKeyData => _onKeyData;
void onKeyData=(KeyDataCallback? callback)

Implementation

set onKeyData(KeyDataCallback? callback) {
  _onKeyData = callback;
  if (callback != null) {
    channelBuffers.setListener(_kFlutterKeyDataChannel, _keyDataListener(callback, Zone.current));
  } else {
    channelBuffers.clearListener(_kFlutterKeyDataChannel);
  }
}