There are multiple heroes that share the same tag

There are multiple heroes that share the same tag within a subtree.

Quick Answer

Two Hero widgets on the same screen have the same tag value.

Why This Happens

In Flutter, Hero widgets use a tag to identify which widgets should animate between screens. If two Hero widgets on the same screen share the same tag, Flutter cannot determine the correct animation pair. Ensure each Hero tag is unique within a screen.

The Problem

ListView(
  children: items.map((item) => Hero(
    tag: 'hero', // Same tag for all items!
    child: Image.network(item.imageUrl),
  )).toList(),
)

The Fix

ListView(
  children: items.map((item) => Hero(
    tag: 'hero-${item.id}', // Unique tag per item
    child: Image.network(item.imageUrl),
  )).toList(),
)

Step-by-Step Fix

  1. 1

    Identify the error

    Look at the error: multiple heroes share the same tag. Two Hero widgets have identical tag values.

  2. 2

    Find the cause

    Check Hero widgets on the current screen, especially in lists, to see if tags are duplicated.

  3. 3

    Apply the fix

    Use a unique identifier (like item ID) in the Hero tag to ensure each Hero has a distinct tag.

Bugsly catches this automatically

Bugsly's AI analyzes this error pattern in real-time, explains what went wrong in plain English, and suggests the exact fix — before your users even report it.

Try Bugsly free