Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Empty PagingData list #36

Open
ixiDev opened this issue May 2, 2023 · 2 comments
Open

Empty PagingData list #36

ixiDev opened this issue May 2, 2023 · 2 comments

Comments

@ixiDev
Copy link

ixiDev commented May 2, 2023

Hi,
Thanks for this lib.

Is it possible to make the function List.toPagingData() in PagingData.kt public so we can create empty paging list as in Paging3 (PagingData.empty())

Here is where we can use it for example;

  val list by pager.pagingData.collectAsState(
       emptyPaging()
    )
@kuuuurt
Copy link
Owner

kuuuurt commented May 2, 2023

Hi. I apologize for not maintaining this library very well. May I ask what's the use case for this? I normally would just use a nullable because an empty list means it has tried to load the list but it's empty. My preference is to use a null to signify and to know that nothing has been loaded yet.

@ixiDev
Copy link
Author

ixiDev commented May 3, 2023

In Jetpack compose the ** collectAsState** need an initial value so normally we pass empty list
because the LazyColumn cannot accept nullable value.
And also we need it when we create FlowState in ViewModel.

Check the source of PagingData PagingData.kt
and doc PagingData.empty()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants