# Remove describeEnum

> The `describeEnum` method has been removed from the Flutter framework. Since Dart 2.14, enums have a `name` getter that does the same thing.




:::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.

[破坏性改动列表](/release/breaking-changes) 
列出了每个版本的文档。

:::


## 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][]

[`enums`]: https://dart.cn/language/enums
[PR 94496]: https://github.com/flutter/flutter/pull/94496
[PR 190076]: https://github.com/flutter/flutter/pull/190076



