首页 > 建站教程 > APP开发,混合APP >  flutter报错:The method '/' was called on null.正文

flutter报错:The method '/' was called on null.

我爱模板网在使用flutter的flutter_screenutil插件时,出现下面这个错误:
The method '/' was called on null.




这个是因为在初始化flutter_screenutil之前,调用了flutter_screenutil设置宽高导致的,解决办法即调用 flutter_screenutil 之前加上下面的代码就好了

注意要加在使用flutter_screenutil 的开头
ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context);