Keys Flutter-இல் widget-களை மீண்டும் கட்டமைக்கும்போது சரியாகக் கண்டறிந்து பாதுகாக்க framework-ஐ உதவுகின்றன — தொகுப்புக்களில் stateful widget-கள் மறுவரிசைப்படுத்தப்பட்டு, சேர்க்கப்பட்டு அல்லது அகற்றப்படும்போது இது மிகவும் முக்கியமாக உள்ளது. 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.
