setUserId static method

Future<bool> setUserId(
  1. String userId
)

Switches the active user for the underlying native SDK instance.

Android behavior:

  • Stops the current recording/session (if running)
  • Switches SDK identity to the provided userId
  • Refreshes configuration from the server for the new user

Notes:

  • This Future completes when the native Android SDK finishes the refresh via its init callback (success/failure).
  • You should call startRecording() again after this returns true.
  • Returns false if the request is rejected locally (e.g., blank userId, SDK not initialized) or if the refresh fails.

Implementation

static Future<bool> setUserId(String userId) async {
  final args = <String, Object>{Constants.paramUserId: userId};
  final bool? result =
      await _channel.invokeMethod<bool>(Constants.caseSetUserId, args);
  return result ?? false;
}