Keys a cikin Flutter suna taimakawa frayim don gano da kare widgets daidai-daidai akan sake ƙirƙira — kusan mahimma don stateful widgets a jeri waɗanda aka sake tsara, ƙari, ko cire. Fahimtar lokacin da ake bukatar keys yana saukaka ɓatacce masu daɗi da rudani.
Menene keys ke yi
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.
