resetForTesting static method

  1. @visibleForTesting
Future<void> resetForTesting()

Clears all tracking state between tests.

Bumps _bufferGeneration, so a flush still awaiting the bridge cannot reinsert its batch into the buffer of the next test.

Implementation

@visibleForTesting
static Future<void> resetForTesting() async {
  _stopContinuousTracking();
  _isTracking = false;
  _isContinuousTracking = false;
  _methodChannel = MethodChannelKalapaBehaviorScoreFlutter();
  await _eventsLock.synchronized(() {
    _bufferGeneration++;
    _events.clear();
  });
}