onPositionChange method

dynamic onPositionChange([
  1. dynamic stream(
    1. int
    )?
])

Implementation

onPositionChange([Function(int)? stream]) {
  _selectedIndex.stream.listen((int index) {
    _currentIndex = index;
    if (stream != null) {
      stream(_currentIndex);
    }
  });
}