Pergunta de entrevista da empresa Sigi Technologies

What are keys in Flutter, and why are they important? Can you explain the difference between GlobalKey and LocalKey?

Resposta da entrevista

Sigiloso

23 de set. de 2025

Keys in Flutter are used to preserve the state of widgets when they move around in the widget tree. They help Flutter distinguish between different widgets and maintain their state. GlobalKey: This key is unique across the entire app and can be used to access the state of a widget from anywhere in the widget tree. It’s often used when you need to interact with a widget outside of its parent. LocalKey: This key is unique only within a specific part of the widget tree. It's commonly used for managing the state of widgets that are siblings or within a small scope.