Raktai Flutter'yje padeda struktūrai teisingai identifikuoti ir išsaugoti valdiklius iš naujo sudarant — ypač svarbu būsenos turintiems valdikliais sąraše, kurie yra perrūšiuojami, pridedami ar šalinami. Supratus, kada raktai reikalingi, išvengiama subtilių, paini sukeliančių klaidų.
Ką raktai daro
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.
