Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sites/docs/src/content/release/breaking-changes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ They're sorted by release and listed in alphabetical order:
* [Added enabled property and made onChanged optional for DropdownButton][]
* [Migrate to standalone `material_ui` and `cupertino_ui` packages][]
* [Restrict command-line flags for prebuilt Android release binaries][]
* [Removal of `useInheritedMediaQuery`][]

[Added enabled property and made onChanged optional for DropdownButton]: /release/breaking-changes/dropdownbutton-enabled-property
[Migrate to standalone `material_ui` and `cupertino_ui` packages]: /release/breaking-changes/material-ui-and-cupertino-ui
[Restrict command-line flags for prebuilt Android release binaries]: /release/breaking-changes/restrict-command-line-flags-prebuilt-android-release-binaries
[Removal of `useInheritedMediaQuery`]: /release/breaking-changes/remove-useInheritedMediaQuery

<a id="released-in-flutter-347" aria-hidden="true"></a>
### Released in Flutter 3.47
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
title: Remove useInheritedMediaQuery
description: >-
The `useInheritedMediaQuery` property has been removed from the Flutter framework.
---

{% render "docs/breaking-changes.md" %}

## Summary

The `useInheritedMediaQuery` properties in `WidgetsApp`, `MaterialApp`, and `CupertinoApp` were removed because these widget never introduced their own MediaQuery, the View widget takes care of that.

## Context

Historically, Flutter used `useInheritedMediaQuery` to determine whether a `WidgetsApp`, `MaterialApp`, or `CupertinoApp` should inherit the `MediaQuery` from its parent. This became redundant when `MediaQuery` inheritance became the default behavior.

## Migration guide

If your code previously used `useInheritedMediaQuery`, you can migrate it by deleting any usage of the property.

```dart diff
- useInheritedMediaQuery: true,
```

```dart diff
- useInheritedMediaQuery: false,
```

:::important
This migration isn't supported by `dart fix`.
:::
Comment on lines +29 to +31

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be by using removeParameter right? What do you think about including a dart fix for this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how create/edit dart fixes tbh


## Timeline

Landed in version: TBD<br>
In stable release: TBD
Comment on lines +35 to +36

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget these when ready.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean when the new stable is cut right ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes


## References

API documentation:

* [`WidgetsApp`][]
* [`MaterialApp`][]
* [`CupertinoApp`][]


Relevant PRs:

* [PR 193146][]
* [PR 12970][]
* [PR 12969][]

[`WidgetsApp`]: {{site.api}}/flutter/widgets/WidgetsApp-class.html
[`MaterialApp`]: {{site.pub}}/documentation/material_ui/latest/material_ui/MaterialApp-class.html
[`CupertinoApp`]: {{site.pub}}/documentation/cupertino_ui/latest/cupertino_ui/CupertinoApp-class.html
Comment thread
sfshaza2 marked this conversation as resolved.
[PR 193146]: {{site.repo.flutter}}/pull/193146
[PR 12970]: {{site.repo.packages}}/pull/12970
[PR 12969]: {{site.repo.packages}}/pull/12969
Loading