import 'IPAndPort.dart'; class StaticHost { bool lighthouse; List destinations; StaticHost({required this.lighthouse, required this.destinations}); factory StaticHost.fromJson(Map json) { var list = json['destinations'] as List; var result = []; list.forEach((item) { result.add(IPAndPort.fromString(item)); }); return StaticHost( lighthouse: json['lighthouse'], destinations: result, ); } Map toJson() { return { 'lighthouse': lighthouse, 'destinations': destinations, }; } }