'Sending an ID or an object as String to the next screen in Jetpack Compose?
I have 30 users displayed in a LazyColumn. On user click, I navigate forward to UserDetailsScreen. My question, is it better to pass the ID of the user and create another database (Room) call inside the second screen, or is it better to pass the object as a String?
I read an answer from @ianhanniballake which says that:
Passing complex data structures over arguments is considered an anti-pattern.
As per my understanding, it's better to only send the ID of the object and not the object itself. However, I have also read, that we can convert the object into a String and pass it further to next screen. Are there any downsides in this case?
Which option is more likely to be used? Is the second one also considered an anti-pattern?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|