alt property

bool alt
final

Whether either (or both) Alt keys should be held for the character to activate the shortcut.

It defaults to false, meaning all Alt keys must be released when the event is received in order to activate the shortcut. If it's true, then either one or both Alt keys must be pressed.

On macOS and iOS, the alt flag indicates that the Option key (⌥) is pressed. Because the Option key affects the character generated on these platforms, it can be unintuitive to define CharacterActivators for them.

For instance, if you want the shortcut to trigger when Option+s (⌥-s) is pressed, and what you intend is to trigger whenever the character 'ß' is produced, you would use CharacterActivator('ß') or CharacterActivator('ß', alt: true) instead of CharacterActivator('s', alt: true). This is because CharacterActivator('s', alt: true) will never trigger, since the 's' character can't be produced when the Option key is held down.

If what is intended is that the shortcut is triggered when Option+s (⌥-s) is pressed, regardless of which character is produced, it is better to use SingleActivator, as in SingleActivator(LogicalKeyboardKey.keyS, alt: true).

See also:

Implementation

final bool alt;