flutter runtime_error ai_generated true

Duplicate GlobalKey detected in widget tree

ID: flutter/key-duplicate-error

Also available as: JSON · Markdown
82%Fix Rate
86%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3 active

Root Cause

Same GlobalKey used in multiple widgets simultaneously.

generic

Workarounds

  1. 90% success Use UniqueKey or ValueKey instead of GlobalKey where possible
  2. 88% success Ensure GlobalKey is used by only one widget at a time

Dead Ends

Common approaches that don't work:

  1. Remove all keys 72% fail

    Loses state preservation and finder capability

  2. Generate random key on each build 78% fail

    Key changes every rebuild