The `ClipboardData constructor`'s `text` argument is no longer nullable. Code that provides `null` to the `text` argument must be migrated to provide an empty string `''`.
Original behavior
In preparation for supporting multiple clipboard data variants, the `ClipboardData` constructor now requires that at least one data variant is provided.
New behavior
The `ClipboardData constructor`'s `text` argument is no longer nullable.
- Who is affected
- Applications and packages relying on the previous behaviour or signature. Code that uses ClipboardData, Clipboard.setData.
- 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 | void resetClipboard() { | |
| 2 | − | Clipboard.setData(ClipboardData(text: null)); |
| 3 | } |
| 1 | void resetClipboard() { | |
| 2 | + | Clipboard.setData(ClipboardData(text: '')); |
| 3 | } |
Raw before / after
void resetClipboard() {
Clipboard.setData(ClipboardData(text: null));
}void resetClipboard() {
Clipboard.setData(ClipboardData(text: ''));
}Official migration guide (excerpt, © The Flutter Authors, CC BY 3.0)
To reset the text clipboard, use an empty string '' instead of null.
Code before migration:
void resetClipboard() {
Clipboard.setData(ClipboardData(text: null));
}Code after migration:
void resetClipboard() {
Clipboard.setData(ClipboardData(text: ''));
}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.
- Official migration guide
- Clipboard.setData
- ClipboardData constructor
- Assert at least one clipboard data variant is provided
- 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.