Flutter shows snackbars through ScaffoldMessenger.
That belongs at the UI edge.
The tricky part is deciding where the event comes from.
If a save action lives in a ViewModel, the widget should not need to own the whole save flow just to show “Saved”.
Dust State has effects for this.
Emit a small event from the ViewModel. Listen with the generated listener widget. Show the snackbar there.
Effects do not change state. They are one-time UI events for mounted listeners.
So the child widget does not rebuild because a snackbar was shown.
Use state for facts that must survive rebuilds. Use effects for short UI work like snackbars or navigation.
Read the Dust State effects guide.

Top comments (0)