# Deprecate `containsSemantics` in favor of `isSemantics`

> The `containsSemantics` matcher has been deprecated in favor of `isSemantics` and `matchesSemantics` matchers.




:::important
These breaking change docs are accurate, as of the release
under which they are published. Over time, the
workarounds described here might become inaccurate.
We don't, in general, keep these breaking change docs up
to date as of each release.

The [breaking change index file](/release/breaking-changes)
lists the docs created for each release.
:::


## Summary

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

## Context

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

* **Partial matchers** (such as `isSemantics`) match only
  the properties explicitly provided.
  Any arguments not provided are ignored.
* **Exact matchers** (such as `matchesSemantics`) verify all values.
  Any arguments not provided are expected to
  match the object's default values.

## Migration guide

To automatically migrate your code, run the following command:

```console
$ 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:

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

Code after migration:

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

## Timeline

Landed in version: 3.40.0-1.0.pre<br>
In stable release: 3.41

## References

API documentation:

* [`isSemantics`][]
* [`matchesSemantics`][]

Relevant issues:

* [Issue 180534][]
* [Issue 107859][]

Relevant PR:

* [PR 180538][]

[`isSemantics`]: https://api.flutter.dev/flutter/flutter_test/isSemantics.html
[`matchesSemantics`]: https://api.flutter.dev/flutter/flutter_test/matchesSemantics.html
[Issue 180534]: https://github.com/flutter/flutter/issues/180534
[Issue 107859]: https://github.com/flutter/flutter/issues/107859
[PR 180538]: https://github.com/flutter/flutter/pull/180538

