operator + method

Keybinding operator +(
  1. Object other
)

Returns a new Keybinding by merging this with the KeyCodes provided by other.

other must be a Keybinding, KeyCode, or Iterable of KeyCodes.

Implementation

Keybinding operator +(Object other) {
  assert(
      other is Keybinding || other is KeyCode || other is Iterable<KeyCode>);

  late Keybinding keybinding;

  if (other is Keybinding) {
    keybinding = Keybinding(keyCodes + other.keyCodes);
  } else if (other is KeyCode) {
    keybinding = Keybinding(keyCodes + [other]);
  } else if (other is Iterable<KeyCode>) {
    keybinding = Keybinding(keyCodes + other);
  }

  return keybinding;
}