mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: use json_serializable
This commit is contained in:
@@ -75,3 +75,47 @@ class ServerPrivateInfoAdapter extends TypeAdapter<ServerPrivateInfo> {
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
ServerPrivateInfo _$ServerPrivateInfoFromJson(Map<String, dynamic> json) =>
|
||||
ServerPrivateInfo(
|
||||
name: json['name'] as String,
|
||||
ip: json['ip'] as String,
|
||||
port: (json['port'] as num).toInt(),
|
||||
user: json['user'] as String,
|
||||
pwd: json['pwd'] as String?,
|
||||
keyId: json['pubKeyId'] as String?,
|
||||
tags: (json['tags'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
||||
alterUrl: json['alterUrl'] as String?,
|
||||
autoConnect: json['autoConnect'] as bool? ?? true,
|
||||
jumpId: json['jumpId'] as String?,
|
||||
custom: json['custom'] == null
|
||||
? null
|
||||
: ServerCustom.fromJson(json['custom'] as Map<String, dynamic>),
|
||||
wolCfg: json['wolCfg'] == null
|
||||
? null
|
||||
: WakeOnLanCfg.fromJson(json['wolCfg'] as Map<String, dynamic>),
|
||||
envs: (json['envs'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(k, e as String),
|
||||
),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ServerPrivateInfoToJson(ServerPrivateInfo instance) =>
|
||||
<String, dynamic>{
|
||||
'name': instance.name,
|
||||
'ip': instance.ip,
|
||||
'port': instance.port,
|
||||
'user': instance.user,
|
||||
'pwd': instance.pwd,
|
||||
'pubKeyId': instance.keyId,
|
||||
'tags': instance.tags,
|
||||
'alterUrl': instance.alterUrl,
|
||||
'autoConnect': instance.autoConnect,
|
||||
'jumpId': instance.jumpId,
|
||||
'custom': instance.custom,
|
||||
'wolCfg': instance.wolCfg,
|
||||
'envs': instance.envs,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user