toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> json = {
    'time': timestamp,
  };

  if (event != null) json['event'] = event;
  if (distance != null) json['distance'] = distance;
  if (duration != null) json['duration'] = duration;
  if (key != null) json['key'] = key;
  if (position != null) json['position'] = position!.toJson();
  if (target != null) json['target'] = target;

  return json;
}