title: Unhandled Exception: inheritFromWidgetOfExactType(_LocalizationsScope) or inheritFromElement() was called before _ScreenState.initState() completed
body: <p>I am calling initial method to load data from API using initState. But it is resulting me an error. Here is error:</p>
  
  <pre><code>Unhandled Exception: inheritFromWidgetOfExactType(_LocalizationsScope) or inheritFromElement() was called before _ScreenState.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.
  </code></pre>
  
  <p>My code is:</p>
  
  <pre><code>@override
    void initState() {
      super.initState();
  
      this._getCategories();
    }
  
    void _getCategories() async {
      AppRoutes.showLoader(context);
      Map&lt;String, dynamic&gt; data = await apiPostCall(
        apiName: API.addUser,
        context: context,
        parameterData: null,
        showAlert: false,
      );
      if(data.isNotEmpty){
        AppRoutes.dismissLoader(context);
        print(data);
  
      }else {
        AppRoutes.dismissLoader(context);
      }
     }
  </code></pre>