I have an error in the overlay.dart file when compiling the flutter project.

huangapple go评论71阅读模式
英文:

I have an error in the in the overlay.dart file when compliling the flutter project

问题

当构建我的Flutter项目时,之前一直可以编译完全没有问题,但从昨天开始,我遇到了这个问题 I have an error in the overlay.dart file when compiling the flutter project.
我已经尽力升级了包和Flutter本身,但问题没有解决。

所以如果有人遇到了相同的问题或有解决方法,我将非常感激。

英文:

when building my flutter project that was compiling perfectly without any problem before but since yesterday i got that problem I have an error in the overlay.dart file when compiling the flutter project.
ans i did all what i could do by upgrading the packages and the flutter itself, but the problem isn't solved

so if anyone face the same problem or have a solution for this problem i would be very thankful

答案1

得分: 0

以下是翻译好的部分:

错误的原因是 Overlay.of(context) 可能为空。可为空对象应使用 ?. 访问其字段。

Overlay.of(context).context.findRenderObject() 替换为 Overlay.of(context)?.context?.findRenderObject() 将修复问题。

英文:

The reason you get the error is Overlay.of(context) could be null. Nullable object should access its field with ?..

Replace Overlay.of(context).context.findRenderObject() with Overlay.of(context)?.context?.findRenderObject() will do the fix.

huangapple
  • 本文由 发表于 2023年4月17日 06:25:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76030625.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定