-
Notifications
You must be signed in to change notification settings - Fork 314
Open
Description
Hi!
Release 4.3.2 added the @nullable annotation for the items property in the AbsDelegationAdapter class. In this regard, all the adapters in our project has been broken. All of them were built according to the following pattern:
internal class TestAdapter : ListDelegationAdapter<List<TestItem>>() {
init {
items = listOf()
delegatesManager
.addDelegate(TestDelegate())
}
fun setData(list: List<TestItem>) {
val oldData = items
items = list
dispatchUpdates(oldData)
}
private fun dispatchUpdates(oldData: List<TestItem>) {
Diffutil
.calculateDiff(TestDiffCallback(items, oldData), false)
.dispatchUpdatesTo(this)
}
}This approach has been used in several different projects that I have worked on.
After the update, this approach stopped working, since now we are operating on a nullable items list:
I have not found an example in Readme how to use ListDelegationAdapter + DiffUtil when list is nullable.
It is possible to check for null each time or write requireNotNull(items) / items!!, but in this case a lot of adapters has to be rewritten.
Is there any correct way to work with ListDelegationAdapter + DiffUtil?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
