NavigationBar constructor Null safety

NavigationBar(
  1. {Key? key,
  2. Duration? animationDuration,
  3. int selectedIndex = 0,
  4. required List<Widget> destinations,
  5. ValueChanged<int>? onDestinationSelected,
  6. Color? backgroundColor,
  7. Color? surfaceTintColor,
  8. double? elevation,
  9. double? height,
  10. NavigationDestinationLabelBehavior? labelBehavior}
)

Creates a Material 3 Navigation Bar component.

The value of destinations must be a list of two or more NavigationDestination values.

Implementation

// TODO(goderbauer): This class cannot be const constructed, https://github.com/dart-lang/linter/issues/3366.
// ignore: prefer_const_constructors_in_immutables
NavigationBar({
  super.key,
  this.animationDuration,
  this.selectedIndex = 0,
  required this.destinations,
  this.onDestinationSelected,
  this.backgroundColor,
  this.surfaceTintColor,
  this.elevation,
  this.height,
  this.labelBehavior,
}) :  assert(destinations != null && destinations.length >= 2),
      assert(0 <= selectedIndex && selectedIndex < destinations.length);