hasAccelerator property

bool hasAccelerator

Whether label contains an accelerator definition.

To indicate which letters in the label are to be used as accelerators, add an "&" character before the character in the string. If more than one character has an "&" in front of it, then the characters appearing earlier in the string are preferred. To represent a literal "&", insert "&&" into the string. All other ampersands will be removed from the string before calling MenuAcceleratorLabel.builder. Bare ampersands at the end of the string or before whitespace are stripped and ignored.

Implementation

bool get hasAccelerator => RegExp(r'&(?!([&\s]|$))').hasMatch(label);