What is the purpose of InheritedNotifier in Flutter?

Why Interviewers Ask This

This is a differentiating question used for senior and lead roles. Interviewers want to see if you can explain not just what happens, but why — and what the trade-offs are in different approaches.

Answer

InheritedNotifier combines InheritedWidget and Listenable. It is a generic InheritedWidget that automatically marks dependent widgets as dirty whenever the wrapped Listenable (like a ValueNotifier or AnimationController) calls its listeners. This means you get the efficiency of InheritedWidget (only rebuilds widgets that depend on it) combined with the simplicity of Listenable-based state. It is used internally by the Flutter framework and is the building block for creating custom, efficient state management solutions without relying on external packages.

Pro Tip

Back up your answer with a specific project or situation. Saying 'In my last Flutter project, I used this when...' immediately makes your answer more credible and memorable.