getCurrentIndex method
Get the current tab index
Implementation
int getCurrentIndex({BuildContext? context}) {
if (_controller != null) {
return _controller!.index;
} else if (context != null) {
final state = context.findAncestorStateOfType<TBottomNavigationState>();
if (state != null) {
return state.controller.index;
} else {
throw Exception(
'TBottomNavigation not found in widget tree and controller not set');
}
} else {
throw Exception('TBottomNavigation controller not initialized');
}
}