Skip to content
Boring Doc
DeprecatedMedium impactOfficial migration guidesince 3.41.0landed 3.40.0-1.0.pre

Deprecate containsSemantics in favor of isSemantics

Framework · Official source

The `containsSemantics` partial matcher is deprecated and replaced by `isSemantics` to clarify intent and standardize matcher conventions.

Original behavior

The `contains` prefix for partial matchers, such as `containsSemantics`, has been replaced with `is` to align with naming conventions:

New behavior

Not stated in the source.

Who is affected
Code that still calls the deprecated API; it keeps working until removal but produces analyzer warnings.
Practical impact
Warnings now; removal in a future release. Plan the migration but no immediate break.
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)

dart+1−1
Before
1 expect(
2 tester.getSemantics(find.byType(MyWidget)),
3− containsSemantics(
4 label: 'My Widget',
5 isButton: true,
6 ),
7 );
After
1 expect(
2 tester.getSemantics(find.byType(MyWidget)),
3+ isSemantics(
4 label: 'My Widget',
5 isButton: true,
6 ),
7 );
Raw before / after
expect(
  tester.getSemantics(find.byType(MyWidget)),
  containsSemantics(
    label: 'My Widget',
    isButton: true,
  ),
);
expect(
  tester.getSemantics(find.byType(MyWidget)),
  isSemantics(
    label: 'My Widget',
    isButton: true,
  ),
);
Official migration guide (excerpt, © The Flutter Authors, CC BY 3.0)

To automatically migrate your code, run the following command:

$ dart fix --apply

Alternatively, replace containsSemantics with isSemantics for partial matching (most common case), or matchesSemantics if you need to assert exact property values (including defaults for omitted arguments).

Code before migration:

expect(
  tester.getSemantics(find.byType(MyWidget)),
  containsSemantics(
    label: 'My Widget',
    isButton: true,
  ),
);

Code after migration:

expect(
  tester.getSemantics(find.byType(MyWidget)),
  isSemantics(
    label: 'My Widget',
    isButton: true,
  ),
);
Migration assistantAI-generated · grounded in cited sources
AI explanations are not configured
Set 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.
Official migration guide·Verified classification (90%)

Listed in the official breaking-changes index; title states deprecation.

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 explanationAI-generated · grounded in cited sources
AI explanations are not configured
Set 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.
Was this useful?