📱 Flutter Intermediate

What is MediaQuery in Flutter?

Why Interviewers Ask This

Candidates at the intermediate level are expected to not only know this concept but explain the trade-offs involved. Interviewers use this question to see if you can reason about design decisions, not just recall facts.

Answer

MediaQuery provides information about the device screen and accessibility settings. Access it via MediaQuery.of(context). Key properties include size (screen dimensions), padding (safe area insets for notches/home bar), viewInsets (keyboard height when visible), orientation, textScaleFactor (user font scaling), and platformBrightness (light/dark mode). It is essential for building responsive layouts and respecting the device's safe areas.

Pro Tip

Demonstrate both theoretical understanding and practical experience. Say what it is, then give an example of how you actually used it in a Flutter codebase.