copyWith method

MenuState copyWith({
  1. MenuItem? selectedItem,
  2. List<MenuItem>? filteredItems,
  3. bool? isOverlayVisible,
  4. int? highlightedIndex,
  5. bool clearHighlight = false,
})

Implementation

MenuState copyWith({
  MenuItem? selectedItem,
  List<MenuItem>? filteredItems,
  bool? isOverlayVisible,
  int? highlightedIndex,
  bool clearHighlight = false,
}) {
  return MenuState(
    selectedItem: selectedItem ?? this.selectedItem,
    filteredItems: filteredItems ?? this.filteredItems,
    isOverlayVisible: isOverlayVisible ?? this.isOverlayVisible,
    highlightedIndex: clearHighlight
        ? null
        : (highlightedIndex ?? this.highlightedIndex),
  );
}