Flutter Web 的“compute()”是否在它自己的线程或 Web Worker 上工作,或者它是如何工作的?

Joh*_*ans 5 flutter flutter-web

如果我这样做,例如:

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(); 
         } 
});
Run Code Online (Sandbox Code Playgroud)

我希望上述内容将expensiveParsingOperation函数发送给网络工作者或其他东西,而不是卡住主线程,但这不是我观察中发生的情况。

SBN*_*NTT 6

compute此时在 web 平台上什么都不做见https://github.com/flutter/flutter/issues/33577