toggle method

void toggle()
inherited

If the state is bool, toggle it and notify listeners

This is a shortcut of:

If the state is not bool, it will throw an assertion error.

Implementation

void toggle() {
  assert(T == bool);
  final snap =
      _reactiveModelState.snapState._copyToHasData(!(_state as bool) as T);
  _reactiveModelState.setSnapStateAndRebuild = snap;
}