menus property Null safety

List<MenuItem> menus
final

The list of menu items that are the top level children of the PlatformMenuBar.

The menus member contains MenuItems. They will not be part of the widget tree, since they are not widgets. They are provided to configure the properties of the menus on the platform menu bar.

Also, a Widget in Flutter is immutable, so directly modifying the menus with List APIs such as somePlatformMenuBarWidget.menus.add(...) will result in incorrect behaviors. Whenever the menus list is modified, a new list object should be provided.

Implementation

final List<MenuItem> menus;