Error : MediaQuery.of() called with a context that does not contain a MediaQuery No MediaQuery ancestor could be found starting from the context that was passed to MediaQuery.of()  

Error : MediaQuery.of() called with a context that does not contain a MediaQuery No MediaQuery ancestor could be found starting from the context that was passed to MediaQuery.of()
This can happen because you do not have a WidgetsApp or MaterialApp widget (those widgets introduce
 a MediaQuery), or it can happen if the context you use comes from a widget above those widgets.
The context used was:
Scaffold(dirty, state: ScaffoldState#3d1d9(lifecycle state: initialized, tickers: tracking 1
ticker)

Most of the times we will get this error while running the flutter application.
Error : MediaQuery.of() called with a context that does not contain a MediaQuery
No MediaQuery ancestor could be found starting from the context that was passed to MediaQuery.of()

This can happen because you do not have a WidgetsApp or MaterialApp widget (those widgets introduce a MediaQuery), or it can happen if the context you use comes from a widget above those widgets.

The context used was:

Scaffold(dirty, state: ScaffoldState(lifecycle state: initialized, tickers: tracking 1
ticker)


 T0 resolve this error by  use the parent widget as MaterilaApp or WidgetsApp