英文:
Error when adding a new language (flutter)
问题
我尝试使用get添加多种语言时遇到了这个错误!我不太擅长使用get,因为我是一个Flutter初学者。但是这个错误只出现在这个类中!错误(如图片所示)在添加单词(.tr)时出现,这可能是因为抽象类吗?
我没有尝试很多次,但我的尝试都失败了[
]
英文:
I got this error when trying to add multiple languages via get! I'm not good at using get because I'm a flutter beginner. But the error appeared only in this class! The error (as shown in the picture) appears when adding the word (.tr), Could it be because of the abstract class?
I didn't try much, but my attempts failed[
]
答案1
得分: 0
.tr 是一个扩展名,而 stg 将在运行时更改。因此 Text 小部件不能是 const。虽然 ScakBar 的内容使用非 const 的 Text(即 .tr),但 SnackBar 不能是 const。
在第 25 行移除 const。
查找更多关于 const 的信息。
英文:
.tr is an extension, and the stg will change on runtime. Therefore Text widget can't be const. While ScakBar's content using non-const Text(being .tr), SnackBar cant be const.
Remove the const on line 25.
Find more about const.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论