toJsonDictionary method

  1. @override
Map<String, dynamic> toJsonDictionary()
override

Converts the trigger to a JSON dictionary. @returns The JSON representation of the trigger.

Implementation

@override
Map<String, dynamic> toJsonDictionary() {
  Map<String, dynamic> dictionary = super.toJsonDictionary();
  dictionary['view'] = view;
  dictionary['times'] = times;
  dictionary['secondsOnView'] = secondsOnView;

  if (completionDate != null) {
    dictionary['completionDate'] =
        completionDate!.millisecondsSinceEpoch ~/ 1000;
  }

  if (numberOfTimes != null) {
    dictionary['numberOfTimes'] = numberOfTimes;
  }

  return dictionary;
}