collapseSynonyms static method

Set<LogicalKeyboardKey> collapseSynonyms(
  1. Set<LogicalKeyboardKey> input
)

Takes a set of keys, and returns the same set, but with any keys that have synonyms replaced.

It is used, for example, to take sets of keys with members like controlRight and controlLeft and convert that set to contain just control, so that the question "is any control key down?" can be asked.

Implementation

static Set<LogicalKeyboardKey> collapseSynonyms(Set<LogicalKeyboardKey> input) {
  return input.expand((LogicalKeyboardKey element) {
    return _synonyms[element] ?? <LogicalKeyboardKey>{element};
  }).toSet();
}