Tracking User Information
Use an external user ID to associate the current device with a contact in Reteno. You can update the ID by itself or include profile attributes, subscription keys, and contact groups.
Set an External User ID
import 'package:reteno_plugin/reteno.dart';
await Reteno().setUserAttributes(
userExternalId: 'USER_ID',
);The external user ID is the contact identifier assigned by your system. Use one stable, non-empty value per user, and match an existing Reteno contact exactly. The Dart API does not reject a blank value, so trim and validate it before calling the SDK.
The returned Future<bool> resolves after the native call is dispatched, not after the server acknowledges it.
Android re-synchronizes the FCM token after any user update. In iOS external mode the application owns that step: call setPushToken() with the current FCM token again after identifying or changing the user. See Push notifications.
Set User Attributes
await Reteno().setUserAttributes(
userExternalId: 'USER_ID',
user: RetenoUser(
userAttributes: UserAttributes(
firstName: 'Jane',
lastName: 'Doe',
email: '[email protected]',
phone: '+380501234567',
languageCode: 'uk-UA',
timeZone: 'Europe/Kyiv',
marketId: 'ua_store',
address: Address(
town: 'Kyiv',
postcode: '01001',
),
fields: [
UserCustomField(key: 'LOYALTY_LEVEL', value: 'gold'),
],
),
subscriptionKeys: ['news'],
groupNamesInclude: ['customers'],
groupNamesExclude: ['prospects'],
),
);RetenoUser supports:
| Property | Type | Description |
|---|---|---|
userAttributes | UserAttributes? | Contact profile fields |
subscriptionKeys | List<String>? | Subscription category keys |
groupNamesInclude | List<String>? | Group names to add the contact to |
groupNamesExclude | List<String>? | Group names to remove the contact from |
All UserAttributes properties are optional: phone, email, firstName, lastName, languageCode, marketId, timeZone (String?), address (Address?), and fields (List<UserCustomField>?).
Address has optional region, town, address, and postcode. UserCustomField requires key and accepts a nullable value; send a non-null string, because iOS converts null to an empty string.
Set Anonymous User Attributes
Anonymous attributes do not require an external user ID. The current public Flutter API uses the method name setAnomymousUserAttributes:
await Reteno().setAnomymousUserAttributes(
anonymousUserAttributes: AnonymousUserAttributes(
firstName: 'Jane',
lastName: 'Doe',
languageCode: 'uk-UA',
timeZone: 'Europe/Kyiv',
marketId: 'ua_store',
address: Address(town: 'Kyiv'),
fields: [
UserCustomField(key: 'LOYALTY_LEVEL', value: 'gold'),
],
),
);AnonymousUserAttributes supports firstName, lastName, languageCode, marketId, timeZone, address, and custom fields. It does not support phone or email; use setUserAttributes() with an external user ID for those fields.
Value Formats
Phone
Use E.164 format, for example +380501234567. The Dart API does not validate it.
Language Code
Use an RFC 5646 language tag whose primary language subtag follows ISO 639-1, for example de-AT or uk-UA.
Time Zone
Use a TZ database name, for example Europe/Kyiv.
Market ID
marketId has a maximum length of 64 characters and supports Latin letters, digits, -, and _. Pass an empty string to clear the value. Native SDKs ignore null values.