mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 23:34:24 +01:00
61 lines
1.3 KiB
Dart
61 lines
1.3 KiB
Dart
import 'dart:convert';
|
|
|
|
///
|
|
/// Code generated by jsonToDartModel https://ashamp.github.io/jsonToDartModel/
|
|
///
|
|
class ServerPrivateInfo {
|
|
/*
|
|
{
|
|
"ip": "",
|
|
"port": 1,
|
|
"user": "",
|
|
"authorization": ""
|
|
}
|
|
*/
|
|
|
|
late String name;
|
|
late String ip;
|
|
late int port;
|
|
late String user;
|
|
late Object authorization;
|
|
String? pubKeyId;
|
|
|
|
ServerPrivateInfo(
|
|
{required this.name,
|
|
required this.ip,
|
|
required this.port,
|
|
required this.user,
|
|
required this.authorization,
|
|
this.pubKeyId});
|
|
ServerPrivateInfo.fromJson(Map<String, dynamic> json) {
|
|
name = json["name"].toString();
|
|
ip = json["ip"].toString();
|
|
port = json["port"].toInt();
|
|
user = json["user"].toString();
|
|
authorization = json["authorization"];
|
|
pubKeyId = json["pubKeyId"]?.toString();
|
|
}
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data["name"] = name;
|
|
data["ip"] = ip;
|
|
data["port"] = port;
|
|
data["user"] = user;
|
|
data["authorization"] = authorization;
|
|
data["pubKeyId"] = pubKeyId;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
List<ServerPrivateInfo> getServerInfoList(dynamic data) {
|
|
List<ServerPrivateInfo> ss = [];
|
|
if (data is String) {
|
|
data = json.decode(data);
|
|
}
|
|
for (var t in data) {
|
|
ss.add(ServerPrivateInfo.fromJson(t));
|
|
}
|
|
|
|
return ss;
|
|
}
|