parseKeyBindings function
Parse raw bindings (from [[keyboard.bindings]]) into Flutter bindings.
Unknown keys are skipped (logged once); unknown actions become
UnsupportedActionIntent; chars produces a SendEscapeIntent.
Implementation
List<KeyBinding> parseKeyBindings(List<RawKeyBinding> raw) {
final out = <KeyBinding>[];
for (final b in raw) {
final key = _logicalForKeyName(b.key);
if (key == null) {
assert(() {
debugPrint('flutter_alacritty: unknown key "${b.key}" in binding (skipped)');
return true;
}());
continue;
}
final mods = _parseMods(b.mods);
final activator = SingleActivator(
key,
control: mods.control,
shift: mods.shift,
alt: mods.alt,
meta: mods.meta,
);
final Intent? intent;
if (b.chars != null) {
intent = SendEscapeIntent(utf8.encode(b.chars!));
} else if (b.action != null) {
intent = _intentForAction(b.action!);
} else {
intent = null;
}
if (intent == null) continue; // None/ReceiveChar/no action → no binding
out.add(KeyBinding(activator, intent, mode: b.mode));
}
return out;
}