TabController constructor

TabController({int initialIndex: 0, @required int length, @required TickerProvider vsync })

Creates an object that manages the state required by TabBar and a TabBarView.

The length must not be null or negative. Typically its a value greater than one, i.e. typically there are two or more tabs.

The initialIndex must be valid given length and must not be null. If length is zero, then initialIndex must be 0 (the default).

Implementation

TabController({ int initialIndex = 0, @required this.length, @required TickerProvider vsync })
  : assert(length != null && length >= 0),
    assert(initialIndex != null && initialIndex >= 0 && (length == 0 || initialIndex < length)),
    _index = initialIndex,
    _previousIndex = initialIndex,
    _animationController = length < 2 ? null : AnimationController(
      value: initialIndex.toDouble(),
      upperBound: (length - 1).toDouble(),
      vsync: vsync
    );