Keys ले Flutter framework लाई rebuild भर्दा widgets लाई सही रूपमा पहचान गर्न र संरक्षण गर्न मद्दत गर्छ — विशेष गरी stateful widgets को सूचीमा जहाँ क्रम बदलिन्छ, थपिन्छ वा हटाइन्छ। कहिले keys चाहिन्छ भनी बुझ्नुले सूक्ष्म र भ्रामक bugs रोक्छ।
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.
