toJson method Null safety

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final targetAddress = this.targetAddress;
  final targetType = this.targetType;
  return {
    if (targetAddress != null) 'TargetAddress': targetAddress,
    if (targetType != null) 'TargetType': targetType,
  };
}