removeAt method
Removes and returns the tab at index.
When the selected tab is removed, the tab that takes its place is
selected. Removing the final tab resets selectedIndex to 0.
Implementation
Tab removeAt(int index) {
_validateIndex(index);
final tab = _tabs.removeAt(index);
if (_tabs.isEmpty) {
_selectedIndex = 0;
} else if (index < _selectedIndex) {
_selectedIndex--;
} else if (index == _selectedIndex && _selectedIndex >= _tabs.length) {
_selectedIndex = _tabs.length - 1;
}
notifyListeners();
return tab;
}