Change model dir structure

This commit is contained in:
LollipopKit
2021-10-28 21:04:59 +08:00
parent 6426277406
commit 6db223ec5a
24 changed files with 71 additions and 51 deletions

View File

@@ -0,0 +1,57 @@
import 'dart:convert';
///
/// Code generated by jsonToDartModel https://ashamp.github.io/jsonToDartModel/
///
class ServerPrivateInfo {
/*
{
"ip": "",
"port": 1,
"user": "",
"authorization": ""
}
*/
String? name;
String? ip;
int? port;
String? user;
Object? authorization;
ServerPrivateInfo({
this.name,
this.ip,
this.port,
this.user,
this.authorization,
});
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"];
}
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;
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;
}