setState method

void setState(
  1. T newState
)

Sets a new state of type T if different from the current state.

If the new state is equal to the current state, no update is performed.

Implementation

void setState(T newState) {
  if (mounted) {
    if (currentState != newState) {
      state = newState;
      debugPrint('State updated.');
    } else {
      debugPrint('New state is equal to current state.');
    }
  } else {
    debugPrint('JController is no longer mounted.');
  }
}