Обновление флаттера: после обновления последней версии флаттера предыдущая функция не работает - PullRequest
0 голосов
/ 25 сентября 2018

Я пробовал эту функцию в версии flutter v0.5.1, и она работает нормально, никаких проблем.После обновления до последней версии v0.8.4 я получаю исключение ниже.

ExcceptionDatainheritFromWidgetOfExactType (_LocalizationsScope) был вызван до завершения ProfileScreen.initState ().

        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 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.

  @override
  void initState() {
    super.initState();
    makeRequest();
  }
  Future<DataModel> makeRequest() async {
    _onLoading();

    http.Response response = await http.get(Uri.encodeFull(getProfile),
        headers: {"Accept": "application/json"});

   /// json data calling.....
  }

  void _onLoading() {

    if (loadCheck) {
        showDialog(
            context: context,
            barrierDismissible: false,
            builder: (BuildContext context) {
              return new Dialog(
                // progress dialog calling );
            }
        );
    } else {
      Navigator.pop(context);
    }
  }
...