Skip to content

Commit 7fb5595

Browse files
committed
Update note: controllers can use createOnce() too
- Removed controllers from StatefulWidget use cases - Clarified that TextEditingController and AnimationController can use createOnce() - Emphasized WatchingWidget is sufficient for most cases - StatefulWidget only needed for true setState scenarios
1 parent 493e0d7 commit 7fb5595

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

docs/documentation/watch_it/watching_widgets.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@ Use when you need both `setState` AND reactive state:
2929
<<< @/../code_samples/lib/watch_it/watching_widgets_patterns.dart#watching_stateful_widget
3030

3131
**Use this when:**
32-
- You need local UI state (filter toggles, form input, expansion state)
33-
- You need animation controllers
32+
- You need local UI state (filter toggles, expansion state)
3433
- Mix `setState` with reactive updates
3534

3635
**Note:** Your State class automatically gets all watch functions - no mixin needed!
3736

3837
**Pattern:** Local state (`_showCompleted`) for UI-only preferences, reactive state (`todos`) from manager, and checkboxes call back into the manager to update data.
3938

40-
> **💡 Important:** With watch_it, you'll **rarely need StatefulWidget anymore**. Most state belongs in your managers and is accessed reactively. Only use StatefulWidget for truly local UI state like animations, text controllers, or temporary UI preferences that don't need to be shared.
39+
> **💡 Important:** With watch_it, you'll **rarely need StatefulWidget anymore**. Most state belongs in your managers and is accessed reactively. Even `TextEditingController` and `AnimationController` can be created with `createOnce()` in `WatchingWidget` - no StatefulWidget needed! Only use StatefulWidget for truly local UI state that requires `setState`.
4140
4241
## Alternative: Using Mixins
4342

0 commit comments

Comments
 (0)