mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
Change model dir structure
This commit is contained in:
57
lib/data/model/server/server_private_info.dart
Normal file
57
lib/data/model/server/server_private_info.dart
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user