DefaultTabController constructor Null safety

const DefaultTabController(
  1. {Key? key,
  2. required int length,
  3. int initialIndex = 0,
  4. required Widget child,
  5. Duration? animationDuration}
)

Creates a default tab controller for the given child widget.

The length argument is typically greater than one. The length must match TabBar.tabs's and TabBarView.children's length.

The initialIndex argument must not be null.

Implementation

const DefaultTabController({
  super.key,
  required this.length,
  this.initialIndex = 0,
  required this.child,
  this.animationDuration,
}) : assert(initialIndex != null),
     assert(length >= 0),
     assert(length == 0 || (initialIndex >= 0 && initialIndex < length));