Keys Flutter मध्ये फ्रेमवर्कला पुनर्निर्मितीच्या दरम्यान विजेट्स योग्यरित्या ओळखायचे आणि संरक्षित ठेवायचे मदत करतात — विशेषतः सूच्यांमध्ये stateful विजेट्सच्या बाबतीत जे पुनर्क्रमित, जोडलेले किंवा काढून टाकलेले होतात. 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.
