All features

Dialogs for Flutter

Reactive dialogs and snackbars

Widget-layer side effects triggered by state changes: no DialogService singleton, no global navigatorKey, no imperative calls from service code.

What this feature covers

  • Status dialogs: Dialogs driven by a change in state, such as a dropped connection.
  • Confirmations: Destructive-action prompts decided by state, not by a raw callback.
  • Snackbars: Error toasts surfaced from state changes.
  • Session banners: Expired-session and connection-loss banners.

How Flutter Agent Kit implements it

The pattern is three steps. A notifier sets a field on the state, such as error or pendingConfirm. A dialog widget lives in the feature's widgets folder. The screen uses ref.listen in a ConsumerWidget build to react to the transition and call showDialog or showSnackBar. Services and notifiers never touch the widget tree.

This replaces the DialogService singleton and the global navigatorKey that older Flutter codebases use, which couple service code to the UI. It works unchanged with the kit's GoRouter setup, because a dialog overlay is not a router route.

Frequently asked questions

Is there a DialogService singleton?

No. A DialogService or a global navigatorKey couples service code to the UI and bypasses the widget tree. The kit triggers dialogs and snackbars from ref.listen in the screen, reacting to a state change instead.

Does this pattern work with GoRouter?

Yes. Navigator.of(context).pop() inside a dialog builder pops the overlay, not a router route, so the dialogs skill and the GoRouter skill coexist without conflict.

Get Flutter Agent Kit

Flutter Agent Kit ships this as a ready feature skill, together with the AGENTS.md context layer and the rest of the skills. €99.99 one-time, lifetime updates, unlimited personal and commercial projects.

Browse all features included in Flutter Agent Kit.