【发布时间】:2019-07-28 11:47:54
【问题描述】:
我正在尝试运行以下代码:
bool isCollapsed;
bool isClosed;
void myFunc(bool isDone){
if (condition) {
setState(() => isDone = true);
}
}
...
myFunc(isCollapsed); // somewhere in the code
...
myFunc(isClosed); // somewhere in the code
基本上我想为两个状态变量使用一个函数,所以我试图将状态变量传递给函数。但这显然行不通。我听说 Dart web 中没有变量表示或 Flutter 允许(仅 Dart 服务器 VM),我自己没有找到解决方法。
【问题讨论】: