clearState method Null safety

  1. @visibleForTesting
void clearState()

Clear all keyboard states and additional handlers.

All handlers are removed except for the first one, which is added by ServicesBinding.

This is used by the testing framework to make sure that tests are hermetic.

Implementation

@visibleForTesting
void clearState() {
  _pressedKeys.clear();
  _lockModes.clear();
  _handlers.clear();
  assert(_modifiedHandlers == null);
}