3
0
Fork 0
trifid_mobile/lib/models/StaticHosts.dart

29 lines
567 B
Dart
Raw Permalink Normal View History

2020-07-27 20:43:58 +00:00
import 'IPAndPort.dart';
class StaticHost {
bool lighthouse;
List<IPAndPort> destinations;
StaticHost({this.lighthouse, this.destinations});
StaticHost.fromJson(Map<String, dynamic> json) {
lighthouse = json['lighthouse'];
var list = json['destinations'] as List<dynamic>;
2021-04-23 17:33:28 +00:00
var result = <IPAndPort>[];
2020-07-27 20:43:58 +00:00
list.forEach((item) {
result.add(IPAndPort.fromString(item));
});
destinations = result;
}
Map<String, dynamic> toJson() {
return {
'lighthouse': lighthouse,
'destinations': destinations,
};
}
}