fromLogicalKey static method

KeyModifier? fromLogicalKey(
  1. LogicalKeyboardKey logicalKey
)

Implementation

static KeyModifier? fromLogicalKey(LogicalKeyboardKey logicalKey) {
  List<int> logicalKeyIdList = [];

  for (List<LogicalKeyboardKey> item in _knownLogicalKeys.values) {
    logicalKeyIdList.addAll(item.map((e) => e.keyId).toList());
  }
  if (!logicalKeyIdList.contains(logicalKey.keyId)) return null;

  return _knownLogicalKeys.entries
      .firstWhere((entry) =>
          entry.value.map((e) => e.keyId).contains(logicalKey.keyId))
      .key;
}