userIdentifier method

Future<void> userIdentifier({
  1. required String? externalId,
  2. String? name,
  3. String? email,
  4. String? phoneNumber,
  5. String? referralCode,
  6. Map<String, dynamic>? properties,
})

Identifies the user and updates their attributes.

Implementation

Future<void> userIdentifier({
  required String? externalId,
  String? name,
  String? email,
  String? phoneNumber,
  String? referralCode,
  Map<String, dynamic>? properties,
}) async {
  if (externalId == null || externalId.isEmpty) {
    NLogger.e("User Identifier failed: External ID cannot be null or empty.");
    return;
  }

  NLogger.d("Identifying User: External ID: $externalId");
  await _nudgeCoreV2NativeServices.invokeNativeMethod('nudge_user_identify', {
    'externalId': externalId,
    'name': name,
    'email': email,
    'phoneNumber': phoneNumber,
    'referralCode': referralCode,
    'properties': properties,
  });
  NLogger.d("User Identification Completed: External ID: $externalId");
}