Single type results from Room
in Flow
streams have an option to filter out unchanged results distinctuntilchanged
, this works perfectly for single type results (ex. Flow<MyObject>
, Flow<String>
, Flow<Int>
, etc.)
However, this is no longer the case when the returning result is a list of objects, ex. Flow<List<MyObject>>
, at least in my case.
In this example, my object type MyObject
is as follows
class MyObject : BaseEntity() {
...
}
Where BaseEntity
is a master Room Entity
object with basic properties that all objects must share in my project.
I understand that PagingDataAdapter
exists, but with it comes a huge boilerplate which is very impractical for small/single use lists, especially when these lists aren't meant to be displayed in the UI
, so for cases where the list is not shown to the user this is not a solution.
How can I make the returned list results be distinct so it won't trigger changes if the list has none? Do I have to use a different object type? Do I have to implement a specific logic somewhere?