createTestSession static method

Future<String?> createTestSession({
  1. Map<String, dynamic>? metadata,
})

Creates a test session for testing session-related functionality.

metadata - Optional metadata for the test session Returns the session ID if successful

Implementation

static Future<String?> createTestSession({
  Map<String, dynamic>? metadata,
}) async {
  try {
    _log('Creating test session');

    // Note: Sessions are automatically managed by the SDK lifecycle
    // Just get the current session ID if one exists
    final sessionId = await ULink.instance
        .getCurrentSessionId();

    if (sessionId != null) {
      _log('Active session found: $sessionId');
    } else {
      _log('No active session (sessions are auto-managed by lifecycle)');
    }

    return sessionId;
  } catch (e) {
    _log('Error creating test session: $e');
    return null;
  }
}