setUserId method

Future<void> setUserId(
  1. String? userId
)

Set a user ID.

important : When the setUserId API is called, if the old userId is not empty and is different from the new userId, a new session is generated. If you do not want to use setUserId to identify a user (for example, when a user signs out), set userId to null. The SDK does not save the user ID. You are advised to set a user ID each time after the app is launched.

Implementation

Future<void> setUserId(
  String? userId,
) async {
  await _channel.invokeMethod(
    'setUserId',
    <String, dynamic>{
      'userId': userId,
    },
  );
}