You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/src/content/docs/async/computed.md
+9-8Lines changed: 9 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -11,30 +11,31 @@ Streams and Futures are the most common async signals, but sometimes you need to
11
11
12
12
## computedAsync
13
13
14
-
Async Computed is syntax sugar around [FutureSignal].
14
+
Async Computed is syntax sugar around FutureSignal.
15
15
16
16
_Inspired by [computedAsync](https://ngxtension.netlify.app/utilities/signals/computed-async/) from Angular NgExtension._
17
17
18
-
computedAsync takes a [callback] function to compute the value
19
-
of the signal. This callback is converted into a [Computed] signal.
18
+
computedAsync takes a callback function to compute the value
19
+
of the signal. This callback is converted into a Computed signal.
20
20
21
21
```dart
22
22
final movieId = signal('id');
23
23
late final movie = computedAsync(() => fetchMovie(movieId()));
24
24
```
25
-
26
-
**It is important that signals are called before any async gaps with await.**
25
+
:::caution
26
+
It is important that signals are called before any async gaps with await.
27
+
:::
27
28
28
29
Any signal that is read inside the callback will be tracked as a dependency and the computed signal will be re-evaluated when any of the dependencies change.
29
30
30
31
## computedFrom
31
32
32
-
Async Computed is syntax sugar around [FutureSignal].
33
+
Async Computed is syntax sugar around FutureSignal.
33
34
34
35
_Inspired by [computedFrom](https://ngxtension.netlify.app/utilities/signals/computed-from/) from Angular NgExtension._
35
36
36
-
computedFrom takes a list of [signals] and a [callback] function to
37
-
compute the value of the signal every time one of the [signals] changes.
37
+
computedFrom takes a list of signals and a callback function to
38
+
compute the value of the signal every time one of the signals changes.
0 commit comments