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:
48
lib/data/model/server/private_key_info.dart
Normal file
48
lib/data/model/server/private_key_info.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'dart:convert';
|
||||
|
||||
///
|
||||
/// Code generated by jsonToDartModel https://ashamp.github.io/jsonToDartModel/
|
||||
///
|
||||
class PrivateKeyInfo {
|
||||
/*
|
||||
{
|
||||
"id": "",
|
||||
"private_key": "",
|
||||
"password": ""
|
||||
}
|
||||
*/
|
||||
|
||||
late String id;
|
||||
late String privateKey;
|
||||
late String password;
|
||||
|
||||
PrivateKeyInfo(
|
||||
this.id,
|
||||
this.privateKey,
|
||||
this.password,
|
||||
);
|
||||
PrivateKeyInfo.fromJson(Map<String, dynamic> json) {
|
||||
id = json["id"].toString();
|
||||
privateKey = json["private_key"].toString();
|
||||
password = json["password"].toString();
|
||||
}
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data["id"] = id;
|
||||
data["private_key"] = privateKey;
|
||||
data["password"] = password;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
List<PrivateKeyInfo>? getPrivateKeyInfoList(dynamic data) {
|
||||
List<PrivateKeyInfo> ss = [];
|
||||
if (data is String) {
|
||||
data = json.decode(data);
|
||||
}
|
||||
for (var t in data) {
|
||||
ss.add(PrivateKeyInfo.fromJson(t));
|
||||
}
|
||||
|
||||
return ss;
|
||||
}
|
||||
Reference in New Issue
Block a user