eneim
08/24/2021, 8:59 AM// Use the index as key to be notified when it is changed.
LaunchedEffect(key1 = listState.firstVisibleItemIndex) {
// Store the listState.firstVisibleItemIndex to DB
}
But it slows down the scroll performance significantly.Albert Chang
08/24/2021, 9:01 AMsnapshotFlow { listState.firstVisibleItemIndex }.collect()
.eneim
08/24/2021, 9:06 AMsnapshotFlow
? It is a global scope method.Albert Chang
08/24/2021, 9:08 AMval listState = rememberLazyListState()
LaunchedEffect(listState) {
snapshotFlow { listState.firstVisibleItemIndex }.collect { index ->
// Save to DB
}
}
eneim
08/24/2021, 9:09 AMsnapshotFlow
? I want to make sure it is noted somewhere that I just happen to not read yet.Albert Chang
08/24/2021, 9:10 AM