identifyContact static method

Future<void> identifyContact({
  1. required String userId,
  2. GleapUserProperty? userProperties,
  3. String? userHash,
})

identifyContact

Updates a session's user data.

Params

gleapUserSession The updated user data.

Available Platforms

Android, iOS, Web

Implementation

static Future<void> identifyContact({
  required String userId,
  GleapUserProperty? userProperties,
  String? userHash,
}) async {
  if (!kIsWeb && !io.Platform.isAndroid && !io.Platform.isIOS) {
    debugPrint(
      'identifyContact is not available for current operating system',
    );
    return;
  }

  if (userProperties != null && userHash != null) {
    await _channel.invokeMethod(
      'identifyContact',
      {
        'userId': userId,
        'userProperties': userProperties.toJson(),
        'userHash': userHash,
      },
    );
  } else if (userProperties != null) {
    await _channel.invokeMethod(
      'identifyContact',
      {
        'userId': userId,
        'userProperties': userProperties.toJson(),
      },
    );
  } else {
    await _channel.invokeMethod('identify', {'userId': userId});
  }
}