findByWidget method

NavigationMenuItemState? findByWidget(
  1. Widget widget
)

Finds a navigation menu item state by its widget.

Parameters:

  • widget (Widget, required): the widget to search for

Returns: NavigationMenuItemState? — the state if found, null otherwise

Implementation

NavigationMenuItemState? findByWidget(Widget widget) {
  return _contentBuilders.keys
      .where((key) => key.widget == widget)
      .firstOrNull;
}