What’s DropdownButton?

A Material Design button for selecting from a list of items. A dropdown button lets the user select from a number of items.

Check the official documentation for more.

To update from DropdownButton to DropdownMenu, you will need to make several changes including using dropdownMenuEntries instead of items, and onSelected instead of onChanged. This is similar to how web frameworks like React, Angular, and Vue handle dropdowns, where state management and event handling are key components.

Example Code

Here is an example of how to use DropdownButton:

flutter create --sample=material.DropdownButton.1 mysample

The DropdownMenu widget’s API is slightly different and it is not required to track the current selection in your app’s state.

Bootstrap Your app with ShipFlutter

A fully customizable starter kit to seamlessly launch responsive Android, iOS, and Web apps with Flutter powered by Firebase and Vertex AI.