英文:
I have an error in the in the overlay.dart file when compliling the flutter project
问题
当构建我的Flutter项目时,之前一直可以编译完全没有问题,但从昨天开始,我遇到了这个问题
我已经尽力升级了包和Flutter本身,但问题没有解决。
所以如果有人遇到了相同的问题或有解决方法,我将非常感激。
英文:
when building my flutter project that was compiling perfectly without any problem before but since yesterday i got that problem
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论