Missing calls to 'dispose()' are added for some disposable objects. For example, ContextMenuController did not dispose OverlayEntry, and EditableTextState did not dispose TextSelectionOverlay.
- Who is affected
- Applications and packages relying on the previous behaviour or signature.
- 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 | − | x.dispose(); |
| 1 | + | if (xIsCreatedByMe) { |
| 2 | + | x.dispose(); |
| 3 | + | } |
Raw before / after
x.dispose();
if (xIsCreatedByMe) {
x.dispose();
}Official migration guide (excerpt, © The Flutter Authors, CC BY 3.0)
If you encounter the following error, update your code to
call dispose() only in cases when your code created the object.
Once you have called dispose() on a <class name>, it can no longer be used.Code before migration:
x.dispose();Code after migration:
if (xIsCreatedByMe) {
x.dispose();
}To locate the incorrect disposal, check the call stack of the error. If the call stack points to dispose
in your code, this disposal is incorrect and should be fixed.
If the error occurs in Flutter code, dispose() was
called incorrectly the first time.
You can locate the incorrect call by temporary calling print(StackTrace.current)
in the body of the failed method dispose.
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.