resetShakeListeners method

void resetShakeListeners()

Gets rid of all the existing listeners

Implementation

void resetShakeListeners() {
  _shakeDetector.close();
  _thresholdController.close();
  if (_accelerometerStream != null) {
    _accelerometerStream?.cancel();
    _accelerometerStream = null;
  }
  if (subscription != null) {
    subscription?.cancel();
    subscription = null;
  }
  _thresholdController = StreamController<int>();
  _shakeDetector = StreamController<bool>();
}