getContactKey

Retrieves the current contact key associated with the device.

Syntax

Future<String?> getContactKey()

Returns

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

Example

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

Related Methods