onPressed property Null safety
final
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.
Implementation
final void Function(int index)? onPressed;