Keys ใน Flutter ช่วยให้ framework ระบุและรักษา widgets ได้อย่างถูกต้องข้าม rebuilds — สำคัญเป็นพิเศษสำหรับ stateful widgets ใน lists ที่ถูกจัดเรียงใหม่ เพิ่ม หรือลบ การเข้าใจว่าเมื่อใดต้องใช้ 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.
