setActiveIndex method
Updates _activeIndex
and triggers a rebuild
Implementation
void setActiveIndex(int index, {bool notify = true}) {
assert(index >= 0 && index < _pages.length);
if (_activeIndex != index) {
final didPreload = preload(index);
_previousIndex = _activeIndex;
_activeIndex = index;
if (notify) {
if (didPreload && SchedulerBinding.instance.schedulerPhase != SchedulerPhase.idle) {
SchedulerBinding.instance.addPostFrameCallback((_) {
notifyAll();
});
} else {
notifyAll();
}
}
}
}