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