getContactKey

Retrieves the current contact key associated with the device.

Syntax 

1Future<String?> getContactKey()

Returns 

  • Future<String?> - Returns the contact key as a string, or null if no contact key is set.

Example 

1String? contactKey = await SfmcSdk.getContactKey();
2if (contactKey != null) {
3  print('Current contact key: $contactKey');
4} else {
5  print('No contact key set');
6}

Related Methods