How to fix "There are multiple heroes that share the same tag within a subtree." error in Flutter?

27.07.2020 23:23
#HATA #FLUTTER #THERE ARE MULTİPLE HEROES THAT SHARE THE SAME TAG WİTHİN A SUBTREE.

How to fix "There are multiple heroes that share the same tag within a subtree." error in Flutter?

"There are multiple heroes that share the same tag within a subtree." I found the solution method of the error.

Before resolving the error, the appearance on the error screen was as follows.

The following assertion was thrown during a scheduler callback:
There are multiple heroes that share the same tag within a subtree.
Within each subtree for which heroes are to be animated (i.e. a PageRoute subtree), each Hero must have a unique non-null tag.
In this case, multiple heroes had the following tag: <default FloatingActionButton tag>
Here is the subtree for one of the offending heroes: Hero
  tag: <default FloatingActionButton tag>
  state: _HeroState#ad45e
When the exception was thrown, this was the stack: 
#0      Hero._allHeroesFor.inviteHero.<anonymous closure> (package:flutter/src/widgets/heroes.dart:266:11)
#1      Hero._allHeroesFor.inviteHero (package:flutter/src/widgets/heroes.dart:277:8)
#2      Hero._allHeroesFor.visitor (package:flutter/src/widgets/heroes.dart:296:21)
#3      SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5817:14)
#4      Hero._allHeroesFor.visitor (package:flutter/src/widgets/heroes.dart:309:15)

So the meaning of this is summarized as follows.

My friend, you put three FloatingActionButtons here. Well, you did well. But in order to distinguish them, you have to give me a name that I will understand who they are.

That's why "There are multiple heroes that share the same tag within a subtree." To solve the error, we need to name heroTag = "fab1" into the FloatingActionButtons.