muteHotKey property
Constructs a HotKey for mute/unmute from these ApplicationSettings.
Implementation
HotKey get muteHotKey {
final List<String> keys = muteKeys ?? [];
final List<HotKeyModifier> modifiers = [];
final List<PhysicalKeyboardKey> physicalKeys = [];
for (var e in keys) {
final modifier = HotKeyModifier.values.firstWhereOrNull(
(m) => m.name == e,
);
if (modifier != null) {
modifiers.add(modifier);
} else {
final int? hid = int.tryParse(e);
if (hid != null) {
physicalKeys.add(PhysicalKeyboardKey(hid));
}
}
}
if (modifiers.isEmpty) {
modifiers.addAll(defaultHotKey.modifiers ?? []);
}
return HotKey(
key: physicalKeys.lastOrNull ?? defaultHotKey.physicalKey,
modifiers: modifiers,
scope: HotKeyScope.system,
);
}