mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-02-19 09:45:26 +00:00
23 lines
586 B
Dart
23 lines
586 B
Dart
import 'IPAndPort.dart';
|
|
|
|
class StaticHost {
|
|
bool lighthouse;
|
|
List<IPAndPort> destinations;
|
|
|
|
StaticHost({required this.lighthouse, required this.destinations});
|
|
|
|
factory StaticHost.fromJson(Map<String, dynamic> json) {
|
|
var list = json['destinations'] as List<dynamic>;
|
|
var result = <IPAndPort>[];
|
|
|
|
list.forEach((item) {
|
|
result.add(IPAndPort.fromString(item));
|
|
});
|
|
|
|
return StaticHost(lighthouse: json['lighthouse'], destinations: result);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {'lighthouse': lighthouse, 'destinations': destinations};
|
|
}
|
|
}
|