Home > Software engineering >  How to get Snapshot in FirestorePagingAdapter with Firebase Ui 8
How to get Snapshot in FirestorePagingAdapter with Firebase Ui 8

Time:01-19

Before the update from

implementation 'com.firebaseui:firebase-ui-firestore:7.2.0'

to

implementation 'com.firebaseui:firebase-ui-firestore:8.0.0'

I got snapshot in FirestorePagingAdapter like this

val snapshot = currentList!![holder.adapterPosition]

but after the update currentList is not working anymore.

I didn't find any documentation about this in the official update guide.


Answer: I solved the issue by using val snapshot = getItem(holder.adapterPosition)

CodePudding user response:

It looks like in the PagingDataAdapter class that FirebaseUI extends, you can get an item by its position by calling getItem(position) or peek(position).

  •  Tags:  
  • Related