generateScripts function
Implementation
String generateScripts(
{DOOUser? user, String? locale, dynamic customAttributes}) {
String script = '';
if (user != null) {
final userObject = {
"event": PostMessageEvents.SET_USER,
"identifier": user.identifier,
"user": user,
};
script += createDOOPostMessage(userObject);
}
if (locale != null) {
final localeObject = {
"event": PostMessageEvents.SET_LOCALE,
"locale": locale
};
script += createDOOPostMessage(localeObject);
}
if (customAttributes != null) {
final attributeObject = {
"event": PostMessageEvents.SET_CUSTOM_ATTRIBUTES,
"customAttributes": customAttributes,
};
script += createDOOPostMessage(attributeObject);
}
return script;
}