Keys fi Flutter jgħinuk il-framework biex jidentifika u jippreserva widgets korrettament matul rebuilds — partikularment importanti għal stateful widgets f'lists li jinkisbu, jiżdiedu, jew jitneħħew. Tifhim meta l-keys huma meħtieža jipprevjeni bugs sottili u konfużi.
X'jagħmlu l-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.
