Using the timer to schedule the code to run instead of running the code directly seems to solve my problem.
bar = newValue;
Timer.run(() {
// run code here
});
The callback seems to be called after new spans are instantiated.
Question
bar
is @observable
. When its value changes, new spans are instantiated.
<template iterate="foo in bar">
<span>{{foo}}</span>
</template>
Is it possible to run dart code right after new spans are created? I tried to run the code right after changing the value of bar
, but at that moment the template still contains old spans.
Thank you for your help!
Solution
Using the timer to schedule the code to run instead of running the code directly seems to solve my problem.
bar = newValue;
Timer.run(() {
// run code here
});
The callback seems to be called after new spans are instantiated.