例如,如果我这样做:
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
函数发送给Web Worker或其他东西,但不影响主线程,但这不是我的观察结果。
compute
目前在网络平台上什么也不做参见https://github.com/flutter/flutter/issues/33577