openDropdownListenable property

Listenable? openDropdownListenable
final

A Listenable that can be used to programmatically open the dropdown menu.

The openDropdownListenable allows you to manually open the dropdown by modifying its value.

For example:

final openDropdownListenable = ValueNotifier<Object?>(null);
@override
Widget build(BuildContext context) {
  return Column(
    children:[
      DropdownButton2<String>(
        // Other properties...
        openDropdownListenable: openDropdownListenable,
      );
      // Open the dropdown programmatically, like when another button is pressed:
      ElevatedButton(
        onTap: () => openDropdownListenable.value = Object(),
      ),
    ],
  );
}

Implementation

final Listenable? openDropdownListenable;