Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 当模板';的内容被实例化_Dart_Dart Webui - Fatal编程技术网

Dart 当模板';的内容被实例化

Dart 当模板';的内容被实例化,dart,dart-webui,Dart,Dart Webui,条是@可观察的。当其值更改时,将实例化新跨距 <template iterate="foo in bar"> <span>{{foo}}</span> </template> {{foo}} 是否可以在创建新跨距后立即运行dart代码?我试图在更改了bar的值之后立即运行代码,但此时模板仍然包含旧的跨距 谢谢你的帮助 使用计时器来安排代码运行,而不是直接运行代码,似乎可以解决我的问题 bar = newValue; Timer.run(

@可观察的
。当其值更改时,将实例化新跨距

<template iterate="foo in bar">
   <span>{{foo}}</span>
</template>

{{foo}}
是否可以在创建新跨距后立即运行dart代码?我试图在更改了
bar
的值之后立即运行代码,但此时模板仍然包含旧的跨距


谢谢你的帮助

使用计时器来安排代码运行,而不是直接运行代码,似乎可以解决我的问题

bar = newValue;
Timer.run(() {
  // run code here
});
回调似乎是在实例化新跨距后调用的

<template iterate="foo in bar">
   <span>{{foo}}</span>
</template>