英文:
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,
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论