# Deprecated the 'value' parameter of the 'DropdownButtonFormField' constructor

> The `DropdownButtonFormField` constructor parameter `value` has been replaced by the parameter `initialValue`.




:::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 `value` parameter of the [`DropdownButtonFormField`][] constructor was
deprecated in favor of the `initialValue` parameter.

## Context

The `value` parameter of the [`DropdownButtonFormField`][] constructor was used
to initialize [`DropdownButtonFormField.initialValue`][].
Not using the same name was confusing. For example,
developers falsely assumed that setting `value` would change
the current selected value. This was not the case—it
only set the initial value or when the field is reset.

## Description of change

The `value` parameter of the [`DropdownButtonFormField`][] constructor is
deprecated in favor of the parameter named `initialValue`.

## Migration guide

Replace the `value` parameter of the [`DropdownButtonFormField`][] constructor
with the `initialValue` parameter to initialize
[`DropdownButtonFormField.initialValue`][].

Code before migration:

```dart highlightLines=2
DropdownButtonFormField(
  value: 'Yellow',
),
```

Code after migration:

```dart highlightLines=2
DropdownButtonFormField(
  initialValue: 'Yellow',
),
```

## Timeline

Landed in version: 3.35.0-0.0.pre<br>
In stable release: 3.35

## References

API documentation:

- [`DropdownButtonFormField`][]
- [`DropdownButtonFormField.initialValue`][]

Relevant issues:

- [Issue #169983][]

Relevant PRs:

- [Deprecate `DropdownButtonFormField` `value` parameter in favor of `initialValue`][]

[`DropdownButtonFormField`]: https://api.flutter-io.cn/flutter/material/DropdownButtonFormField/DropdownButtonFormField.html
[`DropdownButtonFormField.initialValue`]: https://main-api.flutter-io.cn/flutter/widgets/FormField/initialValue.html
[Issue #169983]: https://github.com/flutter/flutter/issues/169983
[Deprecate `DropdownButtonFormField` `value` parameter in favor of `initialValue`]: https://github.com/flutter/flutter/pull/170805

