Skip to main content
InterviewHubPRO
Section Overview
Q18

Question 18 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

36%
Flutter & Dart (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

What is `InheritedWidget` and how does `of(context)` work under the hood?

senior LevelSystem Design

In Simple Words: InheritedWidget is the base class for widgets that efficiently propagate data down the widget tree:

  • When a descendant widget calls MyInherited.of(context), Flutter registers the descendant's Element as a dependent.
  • When the InheritedWidget rebuilds with new data (updateShouldNotify() == true), Flutter automatically rebuilds only the registered dependent descendant widgets, skipping non-dependent siblings!