PodDNSConfig.fromJson constructor

PodDNSConfig.fromJson(
  1. Map<String, dynamic> json
)

Creates a PodDNSConfig from JSON data.

Implementation

factory PodDNSConfig.fromJson(Map<String, dynamic> json) {
  final tempNameserversJson = json['nameservers'];
  final tempOptionsJson = json['options'];
  final tempSearchesJson = json['searches'];

  final List<String>? tempNameservers = tempNameserversJson != null
      ? List<String>.from(tempNameserversJson)
      : null;

  final List<PodDNSConfigOption>? tempOptions = tempOptionsJson != null
      ? List<dynamic>.from(tempOptionsJson)
          .map(
            (e) => PodDNSConfigOption.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  final List<String>? tempSearches =
      tempSearchesJson != null ? List<String>.from(tempSearchesJson) : null;

  return PodDNSConfig(
    nameservers: tempNameservers,
    options: tempOptions,
    searches: tempSearches,
  );
}