mobile_nebula/lib/models/StaticHosts.dart
Nate Brown dbe67c2f81
Upgrade to flutter 3 (#70)
Co-authored-by: John Maguire <contact@johnmaguire.me>
2022-09-21 15:27:35 -05:00

29 lines
624 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,
};
}
}