resetForTesting method

  1. @visibleForTesting
void resetForTesting({
  1. SDKServices? services,
})

Implementation

@visibleForTesting
void resetForTesting({SDKServices? services}) {
  _initialized = false;
  _sdkState = SDKState.notInitialized;
  _campaignsSuppressed = false;
  _engine.close();
  _pendingUserId = null;
  _pendingUserHash = null;
  _pendingClearUserId = false;
  _engine
    ..reset()
    ..resume();
  _inBackground = false;
  _appOpenedDue = false;
  _appOpens = AppOpensCounter();
  // A container the SDK built is released; a test-provided one is the
  // test's to manage.
  if (!_customServicesSet) _services?.dispose();
  _services = services;
  _customServicesSet = services != null;
  // A test is a fresh process: it gets a fresh analytics queue too.
  unawaited(_analyticsQueue?.close());
  _analyticsQueue = null;
  unawaited(_appEventAnalyticsQueue?.close());
  _appEventAnalyticsQueue = null;
}