The default behavior of a `SnackBar` with an action has changed. Previously, a `SnackBar` with an action wouldn't auto-dismiss if talkback was enabled. Now, all `SnackBar` widgets with an action default to a non-dismissible state until the user interacts with the action button.
Original behavior
A `SnackBar` with an action button is now treated as a more persistent notification that requires user interaction. This change improves accessibility and user experience by ensuring that critical notifications remain on the screen until they are acknowledged.
New behavior
This change aligns with the Material 3 design specification for the `SnackBar` component:
- Who is affected
- Applications and packages relying on the previous behaviour or signature. Code that uses SnackBar.
- Practical impact
- Behaviour or API differences that can break builds or change runtime behaviour.
- What action should I take?
- Follow the official migration guide below, update affected call sites, run `dart fix --apply` where a fix is available, then run your tests.
Before and after (from the official guide)
| 1 | ScaffoldMessenger.of(context).showSnackBar( | |
| 2 | SnackBar( | |
| 3 | content: const Text('This is a snackbar with an action.'), | |
| 4 | action: SnackBarAction( | |
| 5 | label: 'Action', | |
| 6 | onPressed: () { | |
| 7 | // Perform some action | |
| 8 | }, | |
| 9 | ), | |
| 10 | ), | |
| 11 | ); |
| 1 | ScaffoldMessenger.of(context).showSnackBar( | |
| 2 | SnackBar( | |
| 3 | content: const Text('This is a snackbar with an action.'), | |
| 4 | + | persist: false, // Add this line to restore auto-dismiss behavior |
| 5 | action: SnackBarAction( | |
| 6 | label: 'Action', | |
| 7 | onPressed: () { | |
| 8 | // Perform some action | |
| 9 | }, | |
| 10 | ), | |
| 11 | ), | |
| 12 | ); |
Raw before / after
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text('This is a snackbar with an action.'),
action: SnackBarAction(
label: 'Action',
onPressed: () {
// Perform some action
},
),
),
);ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text('This is a snackbar with an action.'),
persist: false, // Add this line to restore auto-dismiss behavior
action: SnackBarAction(
label: 'Action',
onPressed: () {
// Perform some action
},
),
),
);Official migration guide (excerpt, © The Flutter Authors, CC BY 3.0)
To restore the old auto-dismiss behavior for a SnackBar with an action, set
persist to false.
Code before migration:
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text('This is a snackbar with an action.'),
action: SnackBarAction(
label: 'Action',
onPressed: () {
// Perform some action
},
),
),
);Code after migration:
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text('This is a snackbar with an action.'),
persist: false, // Add this line to restore auto-dismiss behavior
action: SnackBarAction(
label: 'Action',
onPressed: () {
// Perform some action
},
),
),
);AI_PROVIDER (for example to openai-compatible with a local Ollama or LM Studio endpoint) to enable grounded explanations. Everything else on this page works without an AI provider.Listed in the official breaking-changes index (docs.flutter.dev/release/breaking-changes).
An official announcement or migration guide documents an intended behaviour or API change. A verified source change (git diff) shows code changed but does not by itself prove a public API is breaking. AI interpretations are labelled and never used to classify a change.
- Source commit
- b3045439b7c0
- Source last updated
- Oct 21, 2026
- Last synchronized
- Oct 21, 2026
- Publication status
- published
Publication history
- Oct 21, 2026, 8:31 PM: new → published (ingestion) — Backed by an official breaking-change/migration guide.
AI_PROVIDER (for example to openai-compatible with a local Ollama or LM Studio endpoint) to enable grounded explanations. Everything else on this page works without an AI provider.