triggerFromJsonDictionary static method
Creates a MBTrigger
object from the JSON dictionary, based on the type.
@param jsonDictionary The JSON object to convert to a trigger.
@returns The corresponding MBTrigger
object.
Implementation
static MBTrigger triggerFromJsonDictionary(
Map<String, dynamic> jsonDictionary) {
String triggerTypeString = jsonDictionary['type'];
MBTriggerType triggerType =
MBTrigger.triggerTypeFromString(triggerTypeString);
switch (triggerType) {
case MBTriggerType.location:
return MBLocationTrigger.fromJsonDictionary(jsonDictionary);
case MBTriggerType.appOpening:
return MBAppOpeningTrigger.fromJsonDictionary(jsonDictionary);
case MBTriggerType.view:
return MBViewTrigger.fromJsonDictionary(jsonDictionary);
case MBTriggerType.inactiveUser:
return MBInactiveUserTrigger.fromJsonDictionary(jsonDictionary);
case MBTriggerType.event:
return MBEventTrigger.fromJsonDictionary(jsonDictionary);
case MBTriggerType.tagChange:
return MBTagChangeTrigger.fromJsonDictionary(jsonDictionary);
case MBTriggerType.unknown:
return MBTrigger.fromJsonDictionary(jsonDictionary);
}
}