Flutter Web 的 "compute()" 是否在它自己的线程或 web worker 上工作,或者它是如何工作的?
Does Flutter Web's "compute()" work on it's own thread or web worker, or how does it work?
如果我这样做,例如:
FutureBuilder(
initialData: null,
future: compute(expensiveParsingOperation, data),
builder: (context, snapshot) {
if(!snapshot.hasData){
// This doesn't spin (frozen). The entire UI is janked until the expensive operation future completes.
CircularProgressIndicator();
}else {
Container();
}
});
我希望上面的代码将 expensiveParsingOperation
函数发送给网络工作者或其他东西,而不是让主线程卡顿,但这不是我观察到的情况。
compute
此时在网络平台上什么都不做
见 https://github.com/flutter/flutter/issues/33577
如果我这样做,例如:
FutureBuilder(
initialData: null,
future: compute(expensiveParsingOperation, data),
builder: (context, snapshot) {
if(!snapshot.hasData){
// This doesn't spin (frozen). The entire UI is janked until the expensive operation future completes.
CircularProgressIndicator();
}else {
Container();
}
});
我希望上面的代码将 expensiveParsingOperation
函数发送给网络工作者或其他东西,而不是让主线程卡顿,但这不是我观察到的情况。
compute
此时在网络平台上什么都不做
见 https://github.com/flutter/flutter/issues/33577