onChange property
Called when the user toggles the switch on or off.
The switch passes the new value to the callback but does not actually change state until the parent widget rebuilds the switch with the new value.
Implementation
final ValueChanged<bool>? onChange;