Mobile 飞镖-获取';格式错误的消息';在控制台中生成多个隔离体时

Mobile 飞镖-获取';格式错误的消息';在控制台中生成多个隔离体时,mobile,dart,flutter,dart-isolates,Mobile,Dart,Flutter,Dart Isolates,我是dart新手,我正在尝试使用隔离来运行多个算法,以更有效地多次运行它们,但是,当使用隔离调用多个函数时。spawn我开始在控制台中获得“格式错误的消息”,它仍然有效,但我想知道为什么我会收到此消息,另外,在改进代码方面的任何帮助都是受欢迎的,因为我仍在学习使用隔离的复杂性 stressTest() { ReceivePort rpDouble = new ReceivePort(); ReceivePort rpString = new ReceivePort(); ReceivePort

我是dart新手,我正在尝试使用隔离来运行多个算法,以更有效地多次运行它们,但是,当使用隔离调用多个函数时。spawn我开始在控制台中获得“格式错误的消息”,它仍然有效,但我想知道为什么我会收到此消息,另外,在改进代码方面的任何帮助都是受欢迎的,因为我仍在学习使用隔离的复杂性

 stressTest()
{
ReceivePort rpDouble = new ReceivePort();
ReceivePort rpString = new ReceivePort();
ReceivePort rpInteger = new ReceivePort();
int counter = 0;
int tempoTotal = 0;

  rpDouble.listen((data) {
    counter++;
    tempoTotal += data; //data is a stopwatch.toMilliseconds
    setState(() {  //updating the "progress" and the time it took to run the algorithm in the ui
      test = counter.toString() + '%';
      _counter = tempoTotal.toString();
    });
  });
rpInteger.listen((data){
  counter++;
  tempoTotal += data;
  setState(() {
    test = counter.toString() + '%';
    _counter = tempoTotal.toString();
  });
});
rpString.listen((data){
  counter++;
  tempoTotal += data;
  setState(() {
    test = counter.toString() + '%';
    _counter = tempoTotal.toString();
  });
});

for(int i = 0; i < 5; i++) {
  Isolate.spawn(DoubleTest, rpDouble.sendPort);
  Isolate.spawn(StringStress, rpString.sendPort);
  Isolate.spawn(integerTest, rpInteger.sendPort);
}
}
}
stressTest()
{
ReceivePort rpDouble=新的ReceivePort();
ReceivePort rpString=新的ReceivePort();
ReceivePort rpInteger=新的ReceivePort();
int计数器=0;
int tempoTotal=0;
rpDouble.listen((数据){
计数器++;
tempoTotal+=data;//数据是秒表。秒
setState((){//更新“进度”以及在ui中运行算法所需的时间
test=计数器.toString()+'%';
_计数器=tempoTotal.toString();
});
});
rpInteger.listen((数据){
计数器++;
tempoTotal+=数据;
设置状态(){
test=计数器.toString()+'%';
_计数器=tempoTotal.toString();
});
});
rpString.listen((数据){
计数器++;
tempoTotal+=数据;
设置状态(){
test=计数器.toString()+'%';
_计数器=tempoTotal.toString();
});
});
对于(int i=0;i<5;i++){
隔离.spawn(DoubleTest,rpDouble.sendPort);
隔离.spawn(StringStress,rpString.sendPort);
隔离.spawn(integerTest,rpInteger.sendPort);
}
}
}
DoubleTest、StringStress和IntegerTest是将stopwatch.TomillSeconds整数返回到发送端口的函数


请提前感谢,我们非常感谢您的帮助,因为您的代码运行良好,所以您不必担心错误。但是,请尝试重新格式化代码以避免此错误消息。

我的程序中也有类似问题。只需在“热重启”完成工作之前保存文件。

当您想查看性能应用程序时,就会发生这种情况。但是,在重新加载应用程序期间,重新同步数据会导致颤振性能无法获得地址或中断导致该消息的进度读取器。这不会影响应用程序或应用程序错误。如果需要读取“内存使用情况”或“帧渲染时间”,则只需重新启动IDE并重新启动即可。

可以显示该消息吗?以下是Android Studio控制台中的显示方式:热重启保存文件