From version 5.5.4 the below exception is thrown while building ScreenUtilInit
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
dependOnInheritedWidgetOfExactType<MediaQuery>() or dependOnInheritedElement() was called before
_ScreenUtilInitState.initState() completed.
When an inherited widget changes, for example if the value of Theme.of() changes, its dependent
widgets are rebuilt. If the dependent widget's reference to the inherited widget is in a constructor
or an initState() method, then the rebuilt dependent widget will not reflect the changes in the
inherited widget.
Typically references to inherited widgets should occur in widget build() methods. Alternatively,
initialization based on inherited widgets can be placed in the didChangeDependencies method, which
is called after initState and whenever the dependencies change thereafter.
This PR should resolve issue #434 by ensuring calls to access MediaQueryData happen in didChangeDependencies or build method. If you have better alternatives, do let me know.
From version 5.5.4 the below exception is thrown while building
ScreenUtilInit
This PR should resolve issue #434 by ensuring calls to access
MediaQueryData
happen indidChangeDependencies
orbuild
method. If you have better alternatives, do let me know.