toJson method

Map<String, Object> toJson()

Converts a PodDNSConfig instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempNameservers = nameservers;
  final tempOptions = options;
  final tempSearches = searches;

  if (tempNameservers != null) {
    jsonData['nameservers'] = tempNameservers;
  }

  if (tempOptions != null) {
    jsonData['options'] =
        tempOptions.map((e) => e.toJson()).toList(growable: false);
  }

  if (tempSearches != null) {
    jsonData['searches'] = tempSearches;
  }

  return jsonData;
}