getDebugSnapshot static method

DebugSnapshot getDebugSnapshot()

Returns a safe snapshot of SDK state for debugging.

Implementation

static DebugSnapshot getDebugSnapshot() {
  final publicKey = _config?.publicKey ?? '';
  final last4 =
      publicKey.isEmpty
          ? ''
          : publicKey.length <= 4
          ? publicKey
          : publicKey.substring(publicKey.length - 4);
  final testerId = _testerId ?? '';
  final initialized = _isInitialized && _hasPublicKey;
  final isAnonymous = testerId.startsWith('tst_');
  final connected = initialized && testerId.isNotEmpty && !isAnonymous;
  return DebugSnapshot(
    initialized: initialized,
    baseUrl: _config?.baseUrl ?? _defaultBaseUrl,
    publicKeyLast4: last4,
    testerId: testerId,
    connected: connected,
    lastErrorCode: _lastError,
    lastConnectInputKind: _lastConnectInputKind,
    queuedEventsCount: _queue?.length ?? 0,
    lastFlushAt: _toDateTime(_lastFlushAt),
    lastBootstrapAt: _toDateTime(_lastBootstrapAt),
  );
}