Search code examples
androidkotlinandroid-pagingkotlin-flowandroid-paging-3

Paging 3 PagingSource class doesn't loads at all


PagingSource class doesn't loads. I set breakpoints and logs inside load method, but it skip all.

And in pager config it skips MediaListPagingSource(mediaApi) line.

When I call retrofit method that load data separately it's actually loads!

My setup of Pager

Pager(
        config = PagingConfig(
            pageSize = DEFAULT_PAGE_SIZE,
            enablePlaceholders = false
        ),
        pagingSourceFactory = {
            MediaListPagingSource(mediaApi) // mediaApi - retrofit interface
        }
    ).flow

Solution

  • Ok, I found the solution.

    I'm using Jetpack Compose and need to call .collectAsLazyPagingItems() in composable function to actually collect data.

    Thanks @dlam for hint.