Error when adding a new language (flutter)

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

Error when adding a new language (flutter)

问题

我尝试使用get添加多种语言时遇到了这个错误!我不太擅长使用get,因为我是一个Flutter初学者。但是这个错误只出现在这个类中!错误(如图片所示)在添加单词(.tr)时出现,这可能是因为抽象类吗?

我没有尝试很多次,但我的尝试都失败了[Error when adding a new language (flutter)]

英文:

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[Error when adding a new language (flutter)]

答案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.

huangapple
  • 本文由 发表于 2023年6月15日 05:27:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76477658.html
匿名

发表评论

匿名网友

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

确定