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!

Was it helpful?

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top