# setContactKey

Sets the contact key for the device to associate it with a specific contact in Marketing Cloud.

## Syntax

```dart
Future<void> setContactKey(String contactKey)
```

## Parameters

- `contactKey` (String) - The unique identifier for the contact

## Returns

- `Future<void>` - Completes when the contact key has been set.

## Example

```dart
try {
  await SfmcSdk.setContactKey('user123@example.com');
  print('Contact key set successfully');
} catch (e) {
  print('Failed to set contact key: $e');
}
```

## Related Methods

- [getContactKey()](/docs/marketing/mobile-unified-sdk/references/engagement-mobile-sdk-reference/flutter_getContactKey.md)
