equals method

bool equals(
  1. Keybinding? other
)

Returns true if this and other have equivalent KeyCodes.

Note: KeyCodes are considered equivalent to one another if any one of their keyIds are the same.

Implementation

bool equals(Keybinding? other) {
  if (other == null || keyCodes.length != other.keyCodes.length) {
    return false;
  }

  final otherKeyCodes = List<KeyCode>.from(other.keyCodes);

  for (var keyCode in keyCodes) {
    if (!otherKeyCodes
        .removeFirstWhere((otherKeyCode) => keyCode.equals(otherKeyCode))) {
      return false;
    }
  }

  return true;
}