useTabController function

TabController useTabController({
  1. required int length,
  2. int initialIndex = 0,
  3. TickerProvider? vsync,
  4. Duration? animationDuration,
})

Creates a Tab controller

The controller will be automatically disposed when the component is unmounted

length Number of tabs (required) initialIndex Initial selected tab index

Implementation

TabController useTabController({
  required int length,
  int initialIndex = 0,
  TickerProvider? vsync,
  Duration? animationDuration,
}) {
  return useChangeNotifier(
    () => TabController(
      length: length,
      initialIndex: initialIndex,
      vsync: vsync ?? useSingleTickerProvider(),
      animationDuration: animationDuration,
    ),
  );
}