Flutter: Unhandled Exception: inheritFromWidgetOfExactType(_LocalizationsScope) or inheritFromEle...

Flutter: Unhandled Exception: inheritFromWidgetOfExactType(_LocalizationsScope) or inheritFromElement() was called before Page.initState() completed...

解决办法:
让代码在 initState 后执行...

  @override
  void initState() {
    super.initState();

    Future.delayed(Duration.zero, () {
    //执行代码写在这里
    });
  }

推荐阅读更多精彩内容