1

in Flutter we access an inherited widget fields by using its static of method:

Inhertied_widget.of(context).wanted_field

so, my question is, in a widget (stateless or statefull) when we use something like this:

final ScreenArguments args = ModalRoute.of(context).settings.arguments;

or:

MediaQueryData media = MediaQuery.of(context);

does this mean that the widget inherits from MediaQuery or ModalRoute

thank you.

Jalil.Jarjanazy
  • 839
  • 1
  • 9
  • 22
  • Look at the *Inherited* section in this: https://api.flutter.dev/flutter/widgets/MediaQuery-class.html – Blasanka Sep 28 '19 at 11:32
  • it shows that MediaQuery inherits from Widget, class wise. which doesn't make sense in this case because we are calling MediaQuery of method in a Widget. does InhertiedWidget mean that MediaQuery is a Widget's parent in the Widget tree ? – Jalil.Jarjanazy Sep 28 '19 at 11:44

0 Answers0