Switches, much like their real world counterparts offer a binary choice to the user, moving between True and False states. They often represent on/off states or Yes/no states.
This toggle can even be enabled and disabled to carry out certain pre-defined action for example displaying certain messages or options in one state and hiding the same in the alternate state. Just like TextFields and sliders, here too we need a @state variable to store the current value of the state of the Switch.
In the case of a switch you need to trigger a valueChanged event to toggle between the two states of the switch.
Just like the other UI controls seen before, we can customise the appearance of a switch too.
Toggle(< String >,< parameter >)
The parameter used for switches is a binding boolean that defines on and off states
isOn: < define action >