MBViewTrigger.fromJsonDictionary constructor
MBViewTrigger.fromJsonDictionary(
- Map<String, dynamic> dictionary
)
Implementation
@override
factory MBViewTrigger.fromJsonDictionary(Map<String, dynamic> dictionary) {
String id = dictionary['id'];
String view = dictionary['view'];
int times = dictionary['times'];
int secondsOnView = dictionary['secondsOnView'];
MBViewTrigger trigger = MBViewTrigger(
id: id,
view: view,
times: times,
secondsOnView: secondsOnView,
);
if (dictionary['completionDate'] != null) {
int timeStamp = dictionary['completionDate'] * 1000;
trigger.completionDate = DateTime.fromMillisecondsSinceEpoch(timeStamp);
}
if (dictionary['numberOfTimes'] != null) {
trigger.numberOfTimes = dictionary['numberOfTimes'];
}
return trigger;
}