pageSelections
Create a InitialValueFlow of page selected events on the ViewPager2 instance where the value emitted is the position index of the new selected page.
Note: Created flow keeps a strong reference to the ViewPager2 instance until the coroutine that launched the flow collector is cancelled.
Example of usage:
viewPager2.pageSelections()
.onEach { position ->
// handle position
}
.launchIn(uiScope)
Content copied to clipboard