I want to mark the
ListTile of the current page as selected but 2 days ago I'm looking for a general way to do it.
I saw examples like this one where you hardcode the tile ID and use a case to know which is the current
Tile. My question is, what if I have, to exaggerate, 100
ListTiles? How do I change the
selected attribute programmatically to the selected
Tile? Or a more real case: I have a
Drawer that changes shape in each release, so keeping a code with the hardcoded IDs is not useful. I hope you understand the idea.
I've been trying different solutions for days but none seems general enough to me.
Translated with www.DeepL.com/Translator