onStateWillChange method

bool onStateWillChange(
  1. State oldState,
  2. State newState
)

this method is called when the state is going to be updated By default this method returns true, you can use this method to intercept the newState and check if the new state is valid. If this method returns false the new state will be igonored

Implementation

bool onStateWillChange(State oldState, State newState) =>
    oldState != newState;