Infeasible
Status Update
Comments
ra...@google.com <ra...@google.com>
as...@google.com <as...@google.com>
an...@google.com <an...@google.com> #2
I notice the same issue and LogCat shows the following message:
Google Play services out of date. Requires 3159100 but found 3136130
Google Play services out of date. Requires 3159100 but found 3136130
Description
Current scenario:
Currently, the items method in Jetpack Compose assumes the collection being passed is a List. It also requires each item in the List to have a unique key if a key parameter is provided. However, the responsibility of ensuring the uniqueness of these keys is left to the developer. This approach can lead to potential errors and inconsistencies, as Lists inherently do not enforce key uniqueness.
Proposed enhancement:
I propose that the items method should formally verify the uniqueness of keys. As a part of this enhancement, I also suggest extending support for collections that inherently enforce unique keys, such as Map.
In this proposed approach, the items method could accept a Map data structure directly. This aligns well with the 1:1 nature of key-value pairs in Map, providing a built-in guarantee of key uniqueness. This would not only simplify the development process but also reduce potential bugs and ensure more robust data handling.
Benefits:
Conclusion:
Integrating this feature into Jetpack Compose will provide a more reliable and developer-friendly approach to handling collections with unique keys. The suggested improvement aligns with the goals of Compose to offer a modern toolkit that reduces boilerplate and enhances the developer experience.
Abstract example:
Thank you for considering this proposal. I look forward to the possibility of seeing these enhancements in a future release of Jetpack Compose.
Best regards,
Mark