mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
new: custom cmds (#313)
This commit is contained in:
@@ -4,40 +4,49 @@ part 'custom.g.dart';
|
||||
|
||||
@HiveType(typeId: 7)
|
||||
final class ServerCustom {
|
||||
@HiveField(0)
|
||||
final String? temperature;
|
||||
// @HiveField(0)
|
||||
// final String? temperature;
|
||||
@HiveField(1)
|
||||
final String? pveAddr;
|
||||
@HiveField(2)
|
||||
final bool? pveIgnoreCert;
|
||||
@HiveField(2, defaultValue: false)
|
||||
final bool pveIgnoreCert;
|
||||
|
||||
/// {"title": "cmd"}
|
||||
@HiveField(3)
|
||||
final Map<String, String>? cmds;
|
||||
|
||||
const ServerCustom({
|
||||
this.temperature,
|
||||
//this.temperature,
|
||||
this.pveAddr,
|
||||
this.pveIgnoreCert,
|
||||
this.pveIgnoreCert = false,
|
||||
this.cmds,
|
||||
});
|
||||
|
||||
static ServerCustom fromJson(Map<String, dynamic> json) {
|
||||
final temperature = json["temperature"] as String?;
|
||||
//final temperature = json["temperature"] as String?;
|
||||
final pveAddr = json["pveAddr"] as String?;
|
||||
final pveIgnoreCert = json["pveIgnoreCert"] as bool?;
|
||||
final pveIgnoreCert = json["pveIgnoreCert"] as bool;
|
||||
final cmds = json["cmds"] as Map<String, dynamic>?;
|
||||
return ServerCustom(
|
||||
temperature: temperature,
|
||||
//temperature: temperature,
|
||||
pveAddr: pveAddr,
|
||||
pveIgnoreCert: pveIgnoreCert,
|
||||
cmds: cmds?.cast<String, String>(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (temperature != null) {
|
||||
json["temperature"] = temperature;
|
||||
}
|
||||
// if (temperature != null) {
|
||||
// json["temperature"] = temperature;
|
||||
// }
|
||||
if (pveAddr != null) {
|
||||
json["pveAddr"] = pveAddr;
|
||||
}
|
||||
if (pveIgnoreCert != null) {
|
||||
json["pveIgnoreCert"] = pveIgnoreCert;
|
||||
json["pveIgnoreCert"] = pveIgnoreCert;
|
||||
|
||||
if (cmds != null) {
|
||||
json["cmds"] = cmds;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user