combineKeyEventResults function Null safety

KeyEventResult combineKeyEventResults(
  1. Iterable<KeyEventResult> results

Combine the results returned by multiple FocusOnKeyCallbacks or FocusOnKeyEventCallbacks.

If any callback returns KeyEventResult.handled, the node considers the message handled; otherwise, if any callback returns KeyEventResult.skipRemainingHandlers, the node skips the remaining handlers without preventing the platform to handle; otherwise the node is ignored.


KeyEventResult combineKeyEventResults(Iterable<KeyEventResult> results) {
  bool hasSkipRemainingHandlers = false;
  for (final KeyEventResult result in results) {
    switch (result) {
      case KeyEventResult.handled:
        return KeyEventResult.handled;
      case KeyEventResult.skipRemainingHandlers:
        hasSkipRemainingHandlers = true;
      case KeyEventResult.ignored:
  return hasSkipRemainingHandlers ?
      KeyEventResult.skipRemainingHandlers :