setUserId static method

Future<void> setUserId(
  1. String userId, {
  2. String? userHash,
})

Associates a host user identifier with the current install.

The identifier is persisted and attached to analytics events captured after this call. Use clearUserId to remove it.

userHash is the lowercase-hex HMAC-SHA256 of userId, keyed with the project's verification secret and computed on the host's backend. The server returns imported attributes only when it is valid.

Implementation

static Future<void> setUserId(String userId, {String? userHash}) {
  return SDKInstance.instance.setUserId(userId, userHash: userHash);
}