onPressed property

(void Function(int index)?) onPressed

The callback that is called when a button is tapped.

The index parameter of the callback is the index of the button that is tapped or otherwise activated.

When the callback is null, all toggle buttons will be disabled.


final void Function(int index)? onPressed;