I have encountered this before, and it was because I had two FloatingAction
buttons on one screen, I had to add a heroTag property + value per FloatingActionButton
in order for the error to go away.
Example:
FloatingActionButton(
heroTag: "btn1",
...
)
FloatingActionButton(
heroTag: "btn2",
...
)
From the example code you provided it doesn’t appear that you have a FloatingActionButton
, but from the error it does seem to reference it:
I/flutter (21786): In this case, multiple heroes had the following tag: default FloatingActionButton tag
Perhaps you used it on the page you were navigating to which then triggered the error. Note that if you’re using a programmatic way of creating tagged heroes, you will need to find a way of giving them different tags. For example, if you have a ListView.builder()
creating FloatingActionButtons
, try passing tags with string formatting so each button has a different tag, e.g.: heroTag: "btn$index"
.