android_catalogue1-5 Exercise 3: Pass the Id, Not the Item =========================================================== Reasons passing only the id is better (any two): 1. Routes must be small and serialisable. A Long is trivial; ItemWithDetails contains nested entities and a list, which would need serialisation and make the route long and fragile. 2. Single source of truth. The detail view model reads the item from the database through the repository, so there is exactly one place the data comes from. 3. Survives process death. After the system kills and restores the app, the id in the saved state is enough to reload the item; a copied object would have to be saved and restored too. 4. Decoupling. The list does not need to know what the detail screen displays. Bug with a private copy: the user opens the detail screen, then edits the item (Chapter 6). The copy held by the detail screen is now stale, so the screen keeps showing the old title or tags until it is reopened. Or worse, a later save from that screen overwrites the newer data with the old copy. Reading through a Flow by id (observeItem) avoids both: the screen always shows what is in the database now.