pageScrollEvents

Create a Flow of page scroll events on the ViewPager2 instance.

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.pageScrollEvents()
.onEach { event ->
// handle page scroll event
}
.launchIn(uiScope)