From 01776a3e5fc4a92dda56e354979cfa449b5759a2 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 8 Mar 2021 12:54:03 -0800 Subject: [PATCH] Declare NavigationRailDestination.label as non-nullable (#77427) --- packages/flutter/lib/src/material/navigation_rail.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/flutter/lib/src/material/navigation_rail.dart b/packages/flutter/lib/src/material/navigation_rail.dart index 7aad539985..2b4993cb38 100644 --- a/packages/flutter/lib/src/material/navigation_rail.dart +++ b/packages/flutter/lib/src/material/navigation_rail.dart @@ -490,7 +490,7 @@ class _NavigationRailState extends State with TickerProviderStat extendedTransitionAnimation: _extendedAnimation, selected: widget.selectedIndex == i, icon: widget.selectedIndex == i ? widget.destinations[i].selectedIcon : widget.destinations[i].icon, - label: widget.destinations[i].label!, + label: widget.destinations[i].label, destinationAnimation: _destinationAnimations[i], labelType: labelType, iconTheme: widget.selectedIndex == i ? selectedIconTheme : unselectedIconTheme, @@ -818,10 +818,11 @@ class NavigationRailDestination { const NavigationRailDestination({ required this.icon, Widget? selectedIcon, - this.label, + required this.label, this.padding, }) : selectedIcon = selectedIcon ?? icon, - assert(icon != null); + assert(icon != null), + assert(label != null); /// The icon of the destination. /// @@ -856,7 +857,7 @@ class NavigationRailDestination { /// [NavigationRail.labelType] is [NavigationRailLabelType.none], the label is /// still used for semantics, and may still be used if /// [NavigationRail.extended] is true. - final Widget? label; + final Widget label; /// The amount of space to inset the destination item. final EdgeInsetsGeometry? padding;