Keys Flutter లో ఫ్రేమ్వర్క్ రీబిల్డ్ల సమయంలో విడ్జెట్లను సరిగ్గా గుర్తించడానికి మరియు సংరక్షించడానికి సహాయపడతాయి — ముఖ్యంగా పునర్వ్యవస్థీకరించిన, జోడించిన లేదా తీసివేసిన లిస్ట్లలోని స్టేట్ఫుల్ విడ్జెట్ల కోసం ముఖ్యమైనవి. Keys ఎప్పుడు అవసరమైనవో అర్థం చేసుకోవడం సూక్ష్మమైన, గందరగోళ్కరమైన బగ్లను నిరోధిస్తుంది.
Keys ఏమి చేస్తాయి
During rebuilds, Flutter MATCHES new widgets to existing elements/state by POSITION and
TYPE. Usually this works fine. But when widgets of the SAME TYPE are reordered/added/
removed in a list, position-matching gets confused → state attaches to the WRONG widget.
→ KEYS give widgets a stable IDENTITY so Flutter matches them correctly across changes.
