mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
new: pve (#307)
This commit is contained in:
36
lib/data/model/server/custom.dart
Normal file
36
lib/data/model/server/custom.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:hive_flutter/adapters.dart';
|
||||
|
||||
part 'custom.g.dart';
|
||||
|
||||
@HiveType(typeId: 7)
|
||||
final class ServerCustom {
|
||||
@HiveField(0)
|
||||
final String? temperature;
|
||||
@HiveField(1)
|
||||
final String? pveAddr;
|
||||
|
||||
const ServerCustom({
|
||||
this.temperature,
|
||||
this.pveAddr,
|
||||
});
|
||||
|
||||
static ServerCustom fromJson(Map<String, dynamic> json) {
|
||||
final temperature = json["temperature"] as String?;
|
||||
final pveAddr = json["pveAddr"] as String?;
|
||||
return ServerCustom(
|
||||
temperature: temperature,
|
||||
pveAddr: pveAddr,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (temperature != null) {
|
||||
json["temperature"] = temperature;
|
||||
}
|
||||
if (pveAddr != null) {
|
||||
json["pveAddr"] = pveAddr;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user