Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build runner没有生成js文件 #310

Closed
srs888001 opened this issue Jun 8, 2023 · 2 comments
Closed

build runner没有生成js文件 #310

srs888001 opened this issue Jun 8, 2023 · 2 comments

Comments

@srs888001
Copy link

srs888001 commented Jun 8, 2023

按照官方的 从零开始写一个demo , 运行命令flutter pub run build_runner build , 发现没有生成js文件。 对比了官方自带demo,发现也是部分Widget没有生成js文件。

仔细对应Widget文件发现,是下面代码中super导致的。注释这部分代码是可以生成的。

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

文件生成过程中,也发现了类似下面的错误:
不支持的节点SuperExpressionImpl<---->super.initState()---->super

想请教下, 是super字段不支持吗? 如果不支持, 除了去除代码外,怎么处理或者规避这个问题?

@wanbing
Copy link
Contributor

wanbing commented Jun 25, 2023

原因是FairCompiler中引入的高版本的analyzer解析失败,可以通过固定analyzer版本解决,在目标工程yaml文件添加如下配置:
dependency_overrides:
analyzer: 5.6.0
dart_style: 2.2.5

@wanbing wanbing closed this as completed Jun 25, 2023
@xiaotan1668
Copy link

xiaotan1668 commented Apr 8, 2024

在楼主的问题上,我降低了analyzer和dart_style的版本,这样可以生成js,但是为什么里面的方法不调用呢,还是调用了没有效果,我使用的flutter 3.7.0
@OverRide
void initState() {
setTestInfo();
super.initState()
}

setTestInfo(){
setState(() {
_sum=80;
});
}

另外想加一下fair微信交流群,一直也没通过

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants