Keys Flutter-এ framework কে widgets কে সঠিকভাবে চিহ্নিত করতে এবং rebuilds জুড়ে সংরক্ষণ করতে সাহায্য করে — বিশেষত lists-এ 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.
