Skip to content
Open
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][]
* [OpenGL ES render-to-texture content is stored top-down][]
* [Update semantics header and headingLevel behavior on iOS and Android][]
* [Removal of `describeEnum`][]

[Added enabled property and made onChanged optional for DropdownButton]: /release/breaking-changes/dropdownbutton-enabled-property
[OpenGL ES render-to-texture content is stored top-down]: /release/breaking-changes/opengles-render-to-texture-top-down
[Update semantics header and headingLevel behavior on iOS and Android]: /release/breaking-changes/semantics-header-heading-level
[Removal of `describeEnum`]: /release/breaking-changes/remove-describeEnum

<a id="released-in-flutter-344" aria-hidden="true"></a>
### Released in Flutter 3.44
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
title: Remove describeEnum
description: >-
The `describeEnum` method has been removed from the Flutter framework.
Since Dart 2.14, enums have a `name` getter that does the same thing.
---

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

## Summary

The `describeEnum` method has been removed from the framework because it's redundant with the `name`
getter on `Enum` which was introduced in `Dart 2.14`.

## Context

Historically, Flutter used `describeEnum` to return a `String` description of an enum value.
This became redundant when the `name` getter of `Enum` was introduced in `Dart 2.14`.

## Migration guide

If your code previously used the `describeEnum` method to get the value name of an enum member,
migrate your code to use the `name` getter on the instance itself.

```dart diff
enum Theme { light, dark }

- final theme = describeEnum(Theme.light);

+ Theme.light.name;
```

:::important
This migration isn't supported by `dart fix`.
:::

## Timeline

Landed in version: TBD<br>
In stable release: TBD

## References

API documentation:

* [`enums`][]


Relevant PRs:

* [PR 94496][]
* [PR 190076][]

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.

Would be good to include the PR it was deprecated in

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.

done


[`enums`]: {{site.dart-site}}/language/enums
[PR 94496]: {{site.repo.flutter}}/pull/94496
[PR 190076]: {{site.repo.flutter}}/pull/190076


Loading