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