mobile_nebula/lib/models/StaticHosts.dart

29 lines
571 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>;
var result = List<IPAndPort>();
list.forEach((item) {
result.add(IPAndPort.fromString(item));
});
destinations = result;
}
Map<String, dynamic> toJson() {
return {
'lighthouse': lighthouse,
'destinations': destinations,
};
}
}