表达式不会评估为一个函数,因此不能被调用。

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

The expression doesnt evaluate to a function, so it cant be invoked

问题

如何修复这个问题,我正在尝试创建一个用于切换主题的开关,在 login.dart 中我有一个名为 isDarkMode 的变量,我想使用它来检查应用程序应该在 main.dart 中切换到哪种模式。

英文:

表达式不会评估为一个函数,因此不能被调用。

表达式不会评估为一个函数,因此不能被调用。

How can i fix this, im trying to make switch for changing theme and in login.dart i have variable isDarkMode and i want to use it to check which mode does app have to switch in main.dart

答案1

得分: 1

themeMode: isDarkMode ? ThemeMode.dark : ThemeMode.light,

英文:

It isn't a function so the parentheses not work there. Remove them.

themeMode: isDarkMode? ThemeMode.dark () : ThemeMode.light,

huangapple
  • 本文由 发表于 2023年6月26日 21:35:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76557211.html
匿名

发表评论

匿名网友

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

确定