I often get errors about "There are multiple heroes that share the same tag within a subtree."
For now, I have supplied the tag with Uuid().v4()
. I'm pretty sure that this will be completely random. But I still got these errors.
Here is the subtree for one of the offending heroes: Hero
tag: f63e9e14-55e4-4655-ab96-18b8dbbff524
state: _HeroState#dc119
How can I generate something that will be completely random every time it's called? Or did I use this Hero
widget incorrectly?
FullScreenWidget(child: Hero(child: image(fit: fit), tag: Uuid().v4()));
Just provide one unique id for both hero widgets. F.e.
On first screen
On second screen:
Tag must be unique and stable for all time your app work.