jsonDictionaryForInAppMessage static method
Converts an in app message to a JSON dictionary @param inAppMessage The in app message to convert. @returns The Map that represent the in app message.
Implementation
static Map<String, dynamic> jsonDictionaryForInAppMessage(
MBInAppMessage inAppMessage) {
Map<String, dynamic> dictionary = {
'id': inAppMessage.id,
'style': _stringForInAppMessageStyle(inAppMessage.style),
'isBlocking': inAppMessage.isBlocking,
'duration': inAppMessage.duration,
};
if (inAppMessage.title != null) {
dictionary['title'] = inAppMessage.title;
}
if (inAppMessage.titleColor != null) {
dictionary['titleColor'] = inAppMessage.titleColor!.value;
}
if (inAppMessage.body != null) {
dictionary['body'] = inAppMessage.body;
}
if (inAppMessage.bodyColor != null) {
dictionary['bodyColor'] = inAppMessage.bodyColor!.value;
}
if (inAppMessage.image != null) {
dictionary['image'] = inAppMessage.image;
}
if (inAppMessage.backgroundColor != null) {
dictionary['backgroundColor'] = inAppMessage.backgroundColor!.value;
}
if (inAppMessage.buttons != null) {
dictionary['buttons'] = inAppMessage.buttons!
.map((b) => _jsonDictionaryForButton(b))
.toList();
}
return dictionary;
}