setUserId method

  1. @override
Future<void> setUserId(
  1. String userId
)
override

Sets the user ID for tracking purposes.

This method allows you to set a user ID after the SDK has been initialized.

Throws an UnimplementedError if the platform-specific implementation has not been provided.

Implementation

@override
Future<void> setUserId(String userId) async {
  try {
    await methodChannel.invokeMethod('setUserId', {'userId': userId});
  } on PlatformException {
    rethrow;
  } catch (e) {
    throw PlatformException(
        code: 'SET_USER_ID_ERROR', message: 'Failed to set user ID: $e');
  }
}