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
SignalBuilderWithoutDependenciesError: SignalBuilder was created without tracking any dependencies.
16
+
Make sure to access at least one reactive value (Signal, Computed, etc.) inside the builder callback.
17
+
This might happen if inside your `SignalBuilder.builder` method you are returning a `Builder` widget which won't track reactive values because it is considered a different function because it requires another `builder` function.
18
+
''';
19
+
}
20
+
8
21
/// The [SignalBuilder] function used to build the widget tracking the signals.
'''EffectWithoutDependenciesException: Effect ($name) was created without tracking any dependencies. Make sure to access at least one reactive value (Signal, Computed, etc.) inside the effect callback.''';
18
+
// coverage:ignore-end
19
+
}
20
+
3
21
/// Dispose function
4
22
typedefDisposeEffect=voidFunction();
5
23
@@ -32,7 +50,7 @@ abstract class ReactionInterface {
32
50
/// final counter = Signal(0);
33
51
///
34
52
/// // effect creation
35
-
/// Effect((_) {
53
+
/// Effect(() {
36
54
/// print("The count is now ${counter.value}");
37
55
/// });
38
56
/// // The effect prints `The count is now 0`;
@@ -52,20 +70,13 @@ abstract class ReactionInterface {
52
70
/// ```
53
71
///
54
72
/// Whenever you want to stop the effect from running, you just have to call
55
-
/// the `dispose()` callback
56
-
///
57
-
/// You can also dispose an effect inside the callback
73
+
/// the returned callback of the `Effect` method:
58
74
/// ```dart
59
-
/// Effect((dispose) {
60
-
/// print("The count is now ${counter.value}");
61
-
/// if (counter.value == 1) dispose();
62
-
/// });
75
+
/// final disposeEffect = Effect(() { /* your code */ });
76
+
/// // later
77
+
/// disposeEffect(); // this will stop the effect from running
63
78
/// ```
64
79
///
65
-
/// In the example above the effect is disposed when the counter value is equal
66
-
/// to 1
67
-
///
68
-
///
69
80
/// Any effect runs at least once immediately when is created with the current
70
81
/// signals values.
71
82
///
@@ -173,6 +184,8 @@ class Effect implements ReactionInterface {
173
184
174
185
final _deps =<alien.ReactiveNode>{};
175
186
187
+
bool _firstRun =true;
188
+
176
189
/// The subscriber of the effect, do not use it directly.
0 commit comments