toggle method

void toggle({
  1. bool? value,
})

Toggle the value or set explicitly, then validate.

Implementation

void toggle({bool? value}) {
  final newValue = value ?? !(state.value ?? false);
  onChanged(newValue);
  debugPrint(
    'SwitchCubit | toggle | value: $newValue | error: ${state.errorText}',
  );
}