triggerFromDictionary static method
Creates a MBTrigger
object from the dictionary returned by the APIs, based on the type.
@param jsonDictionary The API Map to convert to a trigger.
@returns The corresponding MBTrigger
object.
Implementation
static MBTrigger triggerFromDictionary(Map<String, dynamic> dictionary) {
String type = dictionary['type'];
switch (type) {
case 'location':
return MBLocationTrigger.fromDictionary(dictionary);
case 'app_opening':
return MBAppOpeningTrigger.fromDictionary(dictionary);
case 'view':
return MBViewTrigger.fromDictionary(dictionary);
case 'inactive_user':
return MBInactiveUserTrigger.fromDictionary(dictionary);
case 'event':
return MBEventTrigger.fromDictionary(dictionary);
case 'tag_change':
return MBTagChangeTrigger.fromDictionary(dictionary);
}
return MBTrigger.fromDictionary(dictionary);
}