NavigationRailDestination constructor Null safety

const NavigationRailDestination(
  1. {required Widget icon,
  2. Widget? selectedIcon,
  3. required Widget label,
  4. EdgeInsetsGeometry? padding}

Creates a destination that is used with NavigationRail.destinations.

icon and label must be non-null. When the NavigationRail.labelType is NavigationRailLabelType.none, the label is still used for semantics, and may still be used if NavigationRail.extended is true.


const NavigationRailDestination({
  required this.icon,
  Widget? selectedIcon,
  required this.label,
}) : selectedIcon = selectedIcon ?? icon,
     assert(icon != null),
     assert(label != null);