Skip to main content
InterviewHubPRO
Section Overview
Q10

Question 10 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

20%
Flutter & Dart (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

What is a `GlobalKey` and why should you avoid overusing it?

junior LevelflutterBasic

In Simple Words: A GlobalKey is globally unique across the entire app:

  • Allows accessing the state of a widget from anywhere in the app (e.g. validating forms via _formKey.currentState!.validate()).
  • Allows reparenting a stateful widget to a different location in the tree without losing its internal state.
  • Caution: Extremely expensive to maintain; overusing GlobalKeys destroys Flutter's element diffing optimizations.