mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
migrate: freezed v3
This commit is contained in:
@@ -7,7 +7,7 @@ part 'disk_smart.freezed.dart';
|
||||
part 'disk_smart.g.dart';
|
||||
|
||||
@freezed
|
||||
class DiskSmart with _$DiskSmart {
|
||||
abstract class DiskSmart with _$DiskSmart {
|
||||
const DiskSmart._();
|
||||
|
||||
const factory DiskSmart({
|
||||
@@ -144,7 +144,7 @@ class DiskSmart with _$DiskSmart {
|
||||
}
|
||||
|
||||
@freezed
|
||||
class SmartAttribute with _$SmartAttribute {
|
||||
abstract class SmartAttribute with _$SmartAttribute {
|
||||
const SmartAttribute._();
|
||||
|
||||
const factory SmartAttribute({
|
||||
@@ -168,7 +168,7 @@ class SmartAttribute with _$SmartAttribute {
|
||||
}
|
||||
|
||||
@freezed
|
||||
class SmartAttributeFlags with _$SmartAttributeFlags {
|
||||
abstract class SmartAttributeFlags with _$SmartAttributeFlags {
|
||||
const SmartAttributeFlags._();
|
||||
|
||||
const factory SmartAttributeFlags({
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,23 +6,21 @@ part of 'disk_smart.dart';
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$DiskSmartImpl _$$DiskSmartImplFromJson(Map<String, dynamic> json) =>
|
||||
_$DiskSmartImpl(
|
||||
device: json['device'] as String,
|
||||
healthy: json['healthy'] as bool?,
|
||||
temperature: (json['temperature'] as num?)?.toDouble(),
|
||||
model: json['model'] as String?,
|
||||
serial: json['serial'] as String?,
|
||||
powerOnHours: (json['powerOnHours'] as num?)?.toInt(),
|
||||
powerCycleCount: (json['powerCycleCount'] as num?)?.toInt(),
|
||||
rawData: json['rawData'] as Map<String, dynamic>,
|
||||
smartAttributes: (json['smartAttributes'] as Map<String, dynamic>).map(
|
||||
(k, e) =>
|
||||
MapEntry(k, SmartAttribute.fromJson(e as Map<String, dynamic>)),
|
||||
),
|
||||
);
|
||||
_DiskSmart _$DiskSmartFromJson(Map<String, dynamic> json) => _DiskSmart(
|
||||
device: json['device'] as String,
|
||||
healthy: json['healthy'] as bool?,
|
||||
temperature: (json['temperature'] as num?)?.toDouble(),
|
||||
model: json['model'] as String?,
|
||||
serial: json['serial'] as String?,
|
||||
powerOnHours: (json['powerOnHours'] as num?)?.toInt(),
|
||||
powerCycleCount: (json['powerCycleCount'] as num?)?.toInt(),
|
||||
rawData: json['rawData'] as Map<String, dynamic>,
|
||||
smartAttributes: (json['smartAttributes'] as Map<String, dynamic>).map(
|
||||
(k, e) => MapEntry(k, SmartAttribute.fromJson(e as Map<String, dynamic>)),
|
||||
),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$DiskSmartImplToJson(_$DiskSmartImpl instance) =>
|
||||
Map<String, dynamic> _$DiskSmartToJson(_DiskSmart instance) =>
|
||||
<String, dynamic>{
|
||||
'device': instance.device,
|
||||
'healthy': instance.healthy,
|
||||
@@ -35,8 +33,8 @@ Map<String, dynamic> _$$DiskSmartImplToJson(_$DiskSmartImpl instance) =>
|
||||
'smartAttributes': instance.smartAttributes,
|
||||
};
|
||||
|
||||
_$SmartAttributeImpl _$$SmartAttributeImplFromJson(Map<String, dynamic> json) =>
|
||||
_$SmartAttributeImpl(
|
||||
_SmartAttribute _$SmartAttributeFromJson(Map<String, dynamic> json) =>
|
||||
_SmartAttribute(
|
||||
id: (json['id'] as num?)?.toInt(),
|
||||
name: json['name'] as String,
|
||||
value: (json['value'] as num?)?.toInt(),
|
||||
@@ -50,35 +48,33 @@ _$SmartAttributeImpl _$$SmartAttributeImplFromJson(Map<String, dynamic> json) =>
|
||||
),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$SmartAttributeImplToJson(
|
||||
_$SmartAttributeImpl instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'value': instance.value,
|
||||
'worst': instance.worst,
|
||||
'thresh': instance.thresh,
|
||||
'whenFailed': instance.whenFailed,
|
||||
'rawValue': instance.rawValue,
|
||||
'rawString': instance.rawString,
|
||||
'flags': instance.flags,
|
||||
};
|
||||
Map<String, dynamic> _$SmartAttributeToJson(_SmartAttribute instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'value': instance.value,
|
||||
'worst': instance.worst,
|
||||
'thresh': instance.thresh,
|
||||
'whenFailed': instance.whenFailed,
|
||||
'rawValue': instance.rawValue,
|
||||
'rawString': instance.rawString,
|
||||
'flags': instance.flags,
|
||||
};
|
||||
|
||||
_$SmartAttributeFlagsImpl _$$SmartAttributeFlagsImplFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _$SmartAttributeFlagsImpl(
|
||||
value: (json['value'] as num?)?.toInt(),
|
||||
string: json['string'] as String?,
|
||||
prefailure: json['prefailure'] as bool? ?? false,
|
||||
updatedOnline: json['updatedOnline'] as bool? ?? false,
|
||||
performance: json['performance'] as bool? ?? false,
|
||||
errorRate: json['errorRate'] as bool? ?? false,
|
||||
eventCount: json['eventCount'] as bool? ?? false,
|
||||
autoKeep: json['autoKeep'] as bool? ?? false,
|
||||
);
|
||||
_SmartAttributeFlags _$SmartAttributeFlagsFromJson(Map<String, dynamic> json) =>
|
||||
_SmartAttributeFlags(
|
||||
value: (json['value'] as num?)?.toInt(),
|
||||
string: json['string'] as String?,
|
||||
prefailure: json['prefailure'] as bool? ?? false,
|
||||
updatedOnline: json['updatedOnline'] as bool? ?? false,
|
||||
performance: json['performance'] as bool? ?? false,
|
||||
errorRate: json['errorRate'] as bool? ?? false,
|
||||
eventCount: json['eventCount'] as bool? ?? false,
|
||||
autoKeep: json['autoKeep'] as bool? ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$SmartAttributeFlagsImplToJson(
|
||||
_$SmartAttributeFlagsImpl instance,
|
||||
Map<String, dynamic> _$SmartAttributeFlagsToJson(
|
||||
_SmartAttributeFlags instance,
|
||||
) => <String, dynamic>{
|
||||
'value': instance.value,
|
||||
'string': instance.string,
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'dart:convert';
|
||||
|
||||
import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:hive_ce_flutter/hive_flutter.dart';
|
||||
import 'package:server_box/data/model/app/error.dart';
|
||||
import 'package:server_box/data/model/server/custom.dart';
|
||||
import 'package:server_box/data/model/server/server.dart';
|
||||
@@ -19,11 +18,11 @@ part 'server_private_info.g.dart';
|
||||
/// Some params named as `spi` in the codebase which is the abbreviation of `ServerPrivateInfo`.
|
||||
///
|
||||
/// Nowaday, more fields are added to this class, and it's renamed to `Spi`.
|
||||
@Freezed(fromJson: false)
|
||||
@JsonSerializable(includeIfNull: false)
|
||||
class Spi with _$Spi {
|
||||
@freezed
|
||||
abstract class Spi with _$Spi {
|
||||
const Spi._();
|
||||
|
||||
@JsonSerializable(includeIfNull: false)
|
||||
const factory Spi({
|
||||
required String name,
|
||||
required String ip,
|
||||
@@ -35,7 +34,7 @@ class Spi with _$Spi {
|
||||
@JsonKey(name: 'pubKeyId') String? keyId,
|
||||
List<String>? tags,
|
||||
String? alterUrl,
|
||||
@Default(true) @JsonKey(defaultValue: true) bool autoConnect,
|
||||
@Default(true) bool autoConnect,
|
||||
|
||||
/// [id] of the jump server
|
||||
String? jumpId,
|
||||
@@ -44,7 +43,7 @@ class Spi with _$Spi {
|
||||
|
||||
/// It only applies to SSH terminal.
|
||||
Map<String, String>? envs,
|
||||
@JsonKey(fromJson: Spi.parseId) @HiveField(13, defaultValue: '') required String id,
|
||||
@Default('') @JsonKey(fromJson: Spi.parseId) String id,
|
||||
}) = _Spi;
|
||||
|
||||
factory Spi.fromJson(Map<String, dynamic> json) => _$SpiFromJson(json);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
@@ -9,479 +10,193 @@ part of 'server_private_info.dart';
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Spi {
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
String get ip => throw _privateConstructorUsedError;
|
||||
int get port => throw _privateConstructorUsedError;
|
||||
String get user => throw _privateConstructorUsedError;
|
||||
String? get pwd => throw _privateConstructorUsedError;
|
||||
|
||||
/// [id] of private key
|
||||
@JsonKey(name: 'pubKeyId')
|
||||
String? get keyId => throw _privateConstructorUsedError;
|
||||
List<String>? get tags => throw _privateConstructorUsedError;
|
||||
String? get alterUrl => throw _privateConstructorUsedError;
|
||||
@JsonKey(defaultValue: true)
|
||||
bool get autoConnect => throw _privateConstructorUsedError;
|
||||
|
||||
/// [id] of the jump server
|
||||
String? get jumpId => throw _privateConstructorUsedError;
|
||||
ServerCustom? get custom => throw _privateConstructorUsedError;
|
||||
WakeOnLanCfg? get wolCfg => throw _privateConstructorUsedError;
|
||||
|
||||
/// It only applies to SSH terminal.
|
||||
Map<String, String>? get envs => throw _privateConstructorUsedError;
|
||||
@JsonKey(fromJson: Spi.parseId)
|
||||
@HiveField(13, defaultValue: '')
|
||||
String get id => throw _privateConstructorUsedError;
|
||||
String get name; String get ip; int get port; String get user; String? get pwd;/// [id] of private key
|
||||
@JsonKey(name: 'pubKeyId') String? get keyId; List<String>? get tags; String? get alterUrl; bool get autoConnect;/// [id] of the jump server
|
||||
String? get jumpId; ServerCustom? get custom; WakeOnLanCfg? get wolCfg;/// It only applies to SSH terminal.
|
||||
Map<String, String>? get envs;@JsonKey(fromJson: Spi.parseId) String get id;
|
||||
/// Create a copy of Spi
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$SpiCopyWith<Spi> get copyWith => _$SpiCopyWithImpl<Spi>(this as Spi, _$identity);
|
||||
|
||||
/// Serializes this Spi to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is Spi&&(identical(other.name, name) || other.name == name)&&(identical(other.ip, ip) || other.ip == ip)&&(identical(other.port, port) || other.port == port)&&(identical(other.user, user) || other.user == user)&&(identical(other.pwd, pwd) || other.pwd == pwd)&&(identical(other.keyId, keyId) || other.keyId == keyId)&&const DeepCollectionEquality().equals(other.tags, tags)&&(identical(other.alterUrl, alterUrl) || other.alterUrl == alterUrl)&&(identical(other.autoConnect, autoConnect) || other.autoConnect == autoConnect)&&(identical(other.jumpId, jumpId) || other.jumpId == jumpId)&&(identical(other.custom, custom) || other.custom == custom)&&(identical(other.wolCfg, wolCfg) || other.wolCfg == wolCfg)&&const DeepCollectionEquality().equals(other.envs, envs)&&(identical(other.id, id) || other.id == id));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,name,ip,port,user,pwd,keyId,const DeepCollectionEquality().hash(tags),alterUrl,autoConnect,jumpId,custom,wolCfg,const DeepCollectionEquality().hash(envs),id);
|
||||
|
||||
|
||||
|
||||
/// Create a copy of Spi
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$SpiCopyWith<Spi> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SpiCopyWith<$Res> {
|
||||
factory $SpiCopyWith(Spi value, $Res Function(Spi) then) =
|
||||
_$SpiCopyWithImpl<$Res, Spi>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String name,
|
||||
String ip,
|
||||
int port,
|
||||
String user,
|
||||
String? pwd,
|
||||
@JsonKey(name: 'pubKeyId') String? keyId,
|
||||
List<String>? tags,
|
||||
String? alterUrl,
|
||||
@JsonKey(defaultValue: true) bool autoConnect,
|
||||
String? jumpId,
|
||||
ServerCustom? custom,
|
||||
WakeOnLanCfg? wolCfg,
|
||||
Map<String, String>? envs,
|
||||
@JsonKey(fromJson: Spi.parseId) @HiveField(13, defaultValue: '') String id,
|
||||
});
|
||||
abstract mixin class $SpiCopyWith<$Res> {
|
||||
factory $SpiCopyWith(Spi value, $Res Function(Spi) _then) = _$SpiCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String name, String ip, int port, String user, String? pwd,@JsonKey(name: 'pubKeyId') String? keyId, List<String>? tags, String? alterUrl, bool autoConnect, String? jumpId, ServerCustom? custom, WakeOnLanCfg? wolCfg, Map<String, String>? envs,@JsonKey(fromJson: Spi.parseId) String id
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$SpiCopyWithImpl<$Res>
|
||||
implements $SpiCopyWith<$Res> {
|
||||
_$SpiCopyWithImpl(this._self, this._then);
|
||||
|
||||
final Spi _self;
|
||||
final $Res Function(Spi) _then;
|
||||
|
||||
/// Create a copy of Spi
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? name = null,Object? ip = null,Object? port = null,Object? user = null,Object? pwd = freezed,Object? keyId = freezed,Object? tags = freezed,Object? alterUrl = freezed,Object? autoConnect = null,Object? jumpId = freezed,Object? custom = freezed,Object? wolCfg = freezed,Object? envs = freezed,Object? id = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,ip: null == ip ? _self.ip : ip // ignore: cast_nullable_to_non_nullable
|
||||
as String,port: null == port ? _self.port : port // ignore: cast_nullable_to_non_nullable
|
||||
as int,user: null == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
|
||||
as String,pwd: freezed == pwd ? _self.pwd : pwd // ignore: cast_nullable_to_non_nullable
|
||||
as String?,keyId: freezed == keyId ? _self.keyId : keyId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,tags: freezed == tags ? _self.tags : tags // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,alterUrl: freezed == alterUrl ? _self.alterUrl : alterUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String?,autoConnect: null == autoConnect ? _self.autoConnect : autoConnect // ignore: cast_nullable_to_non_nullable
|
||||
as bool,jumpId: freezed == jumpId ? _self.jumpId : jumpId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,custom: freezed == custom ? _self.custom : custom // ignore: cast_nullable_to_non_nullable
|
||||
as ServerCustom?,wolCfg: freezed == wolCfg ? _self.wolCfg : wolCfg // ignore: cast_nullable_to_non_nullable
|
||||
as WakeOnLanCfg?,envs: freezed == envs ? _self.envs : envs // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, String>?,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
@JsonSerializable(includeIfNull: false)
|
||||
class _Spi extends Spi {
|
||||
const _Spi({required this.name, required this.ip, required this.port, required this.user, this.pwd, @JsonKey(name: 'pubKeyId') this.keyId, final List<String>? tags, this.alterUrl, this.autoConnect = true, this.jumpId, this.custom, this.wolCfg, final Map<String, String>? envs, @JsonKey(fromJson: Spi.parseId) this.id = ''}): _tags = tags,_envs = envs,super._();
|
||||
factory _Spi.fromJson(Map<String, dynamic> json) => _$SpiFromJson(json);
|
||||
|
||||
@override final String name;
|
||||
@override final String ip;
|
||||
@override final int port;
|
||||
@override final String user;
|
||||
@override final String? pwd;
|
||||
/// [id] of private key
|
||||
@override@JsonKey(name: 'pubKeyId') final String? keyId;
|
||||
final List<String>? _tags;
|
||||
@override List<String>? get tags {
|
||||
final value = _tags;
|
||||
if (value == null) return null;
|
||||
if (_tags is EqualUnmodifiableListView) return _tags;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
@override final String? alterUrl;
|
||||
@override@JsonKey() final bool autoConnect;
|
||||
/// [id] of the jump server
|
||||
@override final String? jumpId;
|
||||
@override final ServerCustom? custom;
|
||||
@override final WakeOnLanCfg? wolCfg;
|
||||
/// It only applies to SSH terminal.
|
||||
final Map<String, String>? _envs;
|
||||
/// It only applies to SSH terminal.
|
||||
@override Map<String, String>? get envs {
|
||||
final value = _envs;
|
||||
if (value == null) return null;
|
||||
if (_envs is EqualUnmodifiableMapView) return _envs;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(value);
|
||||
}
|
||||
|
||||
@override@JsonKey(fromJson: Spi.parseId) final String id;
|
||||
|
||||
/// Create a copy of Spi
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$SpiCopyWith<_Spi> get copyWith => __$SpiCopyWithImpl<_Spi>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$SpiToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Spi&&(identical(other.name, name) || other.name == name)&&(identical(other.ip, ip) || other.ip == ip)&&(identical(other.port, port) || other.port == port)&&(identical(other.user, user) || other.user == user)&&(identical(other.pwd, pwd) || other.pwd == pwd)&&(identical(other.keyId, keyId) || other.keyId == keyId)&&const DeepCollectionEquality().equals(other._tags, _tags)&&(identical(other.alterUrl, alterUrl) || other.alterUrl == alterUrl)&&(identical(other.autoConnect, autoConnect) || other.autoConnect == autoConnect)&&(identical(other.jumpId, jumpId) || other.jumpId == jumpId)&&(identical(other.custom, custom) || other.custom == custom)&&(identical(other.wolCfg, wolCfg) || other.wolCfg == wolCfg)&&const DeepCollectionEquality().equals(other._envs, _envs)&&(identical(other.id, id) || other.id == id));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,name,ip,port,user,pwd,keyId,const DeepCollectionEquality().hash(_tags),alterUrl,autoConnect,jumpId,custom,wolCfg,const DeepCollectionEquality().hash(_envs),id);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SpiCopyWithImpl<$Res, $Val extends Spi> implements $SpiCopyWith<$Res> {
|
||||
_$SpiCopyWithImpl(this._value, this._then);
|
||||
abstract mixin class _$SpiCopyWith<$Res> implements $SpiCopyWith<$Res> {
|
||||
factory _$SpiCopyWith(_Spi value, $Res Function(_Spi) _then) = __$SpiCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String name, String ip, int port, String user, String? pwd,@JsonKey(name: 'pubKeyId') String? keyId, List<String>? tags, String? alterUrl, bool autoConnect, String? jumpId, ServerCustom? custom, WakeOnLanCfg? wolCfg, Map<String, String>? envs,@JsonKey(fromJson: Spi.parseId) String id
|
||||
});
|
||||
|
||||
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of Spi
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = null,
|
||||
Object? ip = null,
|
||||
Object? port = null,
|
||||
Object? user = null,
|
||||
Object? pwd = freezed,
|
||||
Object? keyId = freezed,
|
||||
Object? tags = freezed,
|
||||
Object? alterUrl = freezed,
|
||||
Object? autoConnect = null,
|
||||
Object? jumpId = freezed,
|
||||
Object? custom = freezed,
|
||||
Object? wolCfg = freezed,
|
||||
Object? envs = freezed,
|
||||
Object? id = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
ip: null == ip
|
||||
? _value.ip
|
||||
: ip // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
port: null == port
|
||||
? _value.port
|
||||
: port // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
user: null == user
|
||||
? _value.user
|
||||
: user // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
pwd: freezed == pwd
|
||||
? _value.pwd
|
||||
: pwd // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
keyId: freezed == keyId
|
||||
? _value.keyId
|
||||
: keyId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
tags: freezed == tags
|
||||
? _value.tags
|
||||
: tags // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
alterUrl: freezed == alterUrl
|
||||
? _value.alterUrl
|
||||
: alterUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
autoConnect: null == autoConnect
|
||||
? _value.autoConnect
|
||||
: autoConnect // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
jumpId: freezed == jumpId
|
||||
? _value.jumpId
|
||||
: jumpId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
custom: freezed == custom
|
||||
? _value.custom
|
||||
: custom // ignore: cast_nullable_to_non_nullable
|
||||
as ServerCustom?,
|
||||
wolCfg: freezed == wolCfg
|
||||
? _value.wolCfg
|
||||
: wolCfg // ignore: cast_nullable_to_non_nullable
|
||||
as WakeOnLanCfg?,
|
||||
envs: freezed == envs
|
||||
? _value.envs
|
||||
: envs // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, String>?,
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SpiImplCopyWith<$Res> implements $SpiCopyWith<$Res> {
|
||||
factory _$$SpiImplCopyWith(_$SpiImpl value, $Res Function(_$SpiImpl) then) =
|
||||
__$$SpiImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String name,
|
||||
String ip,
|
||||
int port,
|
||||
String user,
|
||||
String? pwd,
|
||||
@JsonKey(name: 'pubKeyId') String? keyId,
|
||||
List<String>? tags,
|
||||
String? alterUrl,
|
||||
@JsonKey(defaultValue: true) bool autoConnect,
|
||||
String? jumpId,
|
||||
ServerCustom? custom,
|
||||
WakeOnLanCfg? wolCfg,
|
||||
Map<String, String>? envs,
|
||||
@JsonKey(fromJson: Spi.parseId) @HiveField(13, defaultValue: '') String id,
|
||||
});
|
||||
class __$SpiCopyWithImpl<$Res>
|
||||
implements _$SpiCopyWith<$Res> {
|
||||
__$SpiCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Spi _self;
|
||||
final $Res Function(_Spi) _then;
|
||||
|
||||
/// Create a copy of Spi
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? name = null,Object? ip = null,Object? port = null,Object? user = null,Object? pwd = freezed,Object? keyId = freezed,Object? tags = freezed,Object? alterUrl = freezed,Object? autoConnect = null,Object? jumpId = freezed,Object? custom = freezed,Object? wolCfg = freezed,Object? envs = freezed,Object? id = null,}) {
|
||||
return _then(_Spi(
|
||||
name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,ip: null == ip ? _self.ip : ip // ignore: cast_nullable_to_non_nullable
|
||||
as String,port: null == port ? _self.port : port // ignore: cast_nullable_to_non_nullable
|
||||
as int,user: null == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
|
||||
as String,pwd: freezed == pwd ? _self.pwd : pwd // ignore: cast_nullable_to_non_nullable
|
||||
as String?,keyId: freezed == keyId ? _self.keyId : keyId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,tags: freezed == tags ? _self._tags : tags // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,alterUrl: freezed == alterUrl ? _self.alterUrl : alterUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String?,autoConnect: null == autoConnect ? _self.autoConnect : autoConnect // ignore: cast_nullable_to_non_nullable
|
||||
as bool,jumpId: freezed == jumpId ? _self.jumpId : jumpId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,custom: freezed == custom ? _self.custom : custom // ignore: cast_nullable_to_non_nullable
|
||||
as ServerCustom?,wolCfg: freezed == wolCfg ? _self.wolCfg : wolCfg // ignore: cast_nullable_to_non_nullable
|
||||
as WakeOnLanCfg?,envs: freezed == envs ? _self._envs : envs // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, String>?,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SpiImplCopyWithImpl<$Res> extends _$SpiCopyWithImpl<$Res, _$SpiImpl>
|
||||
implements _$$SpiImplCopyWith<$Res> {
|
||||
__$$SpiImplCopyWithImpl(_$SpiImpl _value, $Res Function(_$SpiImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of Spi
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = null,
|
||||
Object? ip = null,
|
||||
Object? port = null,
|
||||
Object? user = null,
|
||||
Object? pwd = freezed,
|
||||
Object? keyId = freezed,
|
||||
Object? tags = freezed,
|
||||
Object? alterUrl = freezed,
|
||||
Object? autoConnect = null,
|
||||
Object? jumpId = freezed,
|
||||
Object? custom = freezed,
|
||||
Object? wolCfg = freezed,
|
||||
Object? envs = freezed,
|
||||
Object? id = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$SpiImpl(
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
ip: null == ip
|
||||
? _value.ip
|
||||
: ip // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
port: null == port
|
||||
? _value.port
|
||||
: port // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
user: null == user
|
||||
? _value.user
|
||||
: user // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
pwd: freezed == pwd
|
||||
? _value.pwd
|
||||
: pwd // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
keyId: freezed == keyId
|
||||
? _value.keyId
|
||||
: keyId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
tags: freezed == tags
|
||||
? _value._tags
|
||||
: tags // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
alterUrl: freezed == alterUrl
|
||||
? _value.alterUrl
|
||||
: alterUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
autoConnect: null == autoConnect
|
||||
? _value.autoConnect
|
||||
: autoConnect // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
jumpId: freezed == jumpId
|
||||
? _value.jumpId
|
||||
: jumpId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
custom: freezed == custom
|
||||
? _value.custom
|
||||
: custom // ignore: cast_nullable_to_non_nullable
|
||||
as ServerCustom?,
|
||||
wolCfg: freezed == wolCfg
|
||||
? _value.wolCfg
|
||||
: wolCfg // ignore: cast_nullable_to_non_nullable
|
||||
as WakeOnLanCfg?,
|
||||
envs: freezed == envs
|
||||
? _value._envs
|
||||
: envs // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, String>?,
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable(createFactory: false)
|
||||
class _$SpiImpl extends _Spi {
|
||||
const _$SpiImpl({
|
||||
required this.name,
|
||||
required this.ip,
|
||||
required this.port,
|
||||
required this.user,
|
||||
this.pwd,
|
||||
@JsonKey(name: 'pubKeyId') this.keyId,
|
||||
final List<String>? tags,
|
||||
this.alterUrl,
|
||||
@JsonKey(defaultValue: true) this.autoConnect = true,
|
||||
this.jumpId,
|
||||
this.custom,
|
||||
this.wolCfg,
|
||||
final Map<String, String>? envs,
|
||||
@JsonKey(fromJson: Spi.parseId)
|
||||
@HiveField(13, defaultValue: '')
|
||||
required this.id,
|
||||
}) : _tags = tags,
|
||||
_envs = envs,
|
||||
super._();
|
||||
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
final String ip;
|
||||
@override
|
||||
final int port;
|
||||
@override
|
||||
final String user;
|
||||
@override
|
||||
final String? pwd;
|
||||
|
||||
/// [id] of private key
|
||||
@override
|
||||
@JsonKey(name: 'pubKeyId')
|
||||
final String? keyId;
|
||||
final List<String>? _tags;
|
||||
@override
|
||||
List<String>? get tags {
|
||||
final value = _tags;
|
||||
if (value == null) return null;
|
||||
if (_tags is EqualUnmodifiableListView) return _tags;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
@override
|
||||
final String? alterUrl;
|
||||
@override
|
||||
@JsonKey(defaultValue: true)
|
||||
final bool autoConnect;
|
||||
|
||||
/// [id] of the jump server
|
||||
@override
|
||||
final String? jumpId;
|
||||
@override
|
||||
final ServerCustom? custom;
|
||||
@override
|
||||
final WakeOnLanCfg? wolCfg;
|
||||
|
||||
/// It only applies to SSH terminal.
|
||||
final Map<String, String>? _envs;
|
||||
|
||||
/// It only applies to SSH terminal.
|
||||
@override
|
||||
Map<String, String>? get envs {
|
||||
final value = _envs;
|
||||
if (value == null) return null;
|
||||
if (_envs is EqualUnmodifiableMapView) return _envs;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(value);
|
||||
}
|
||||
|
||||
@override
|
||||
@JsonKey(fromJson: Spi.parseId)
|
||||
@HiveField(13, defaultValue: '')
|
||||
final String id;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SpiImpl &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.ip, ip) || other.ip == ip) &&
|
||||
(identical(other.port, port) || other.port == port) &&
|
||||
(identical(other.user, user) || other.user == user) &&
|
||||
(identical(other.pwd, pwd) || other.pwd == pwd) &&
|
||||
(identical(other.keyId, keyId) || other.keyId == keyId) &&
|
||||
const DeepCollectionEquality().equals(other._tags, _tags) &&
|
||||
(identical(other.alterUrl, alterUrl) ||
|
||||
other.alterUrl == alterUrl) &&
|
||||
(identical(other.autoConnect, autoConnect) ||
|
||||
other.autoConnect == autoConnect) &&
|
||||
(identical(other.jumpId, jumpId) || other.jumpId == jumpId) &&
|
||||
(identical(other.custom, custom) || other.custom == custom) &&
|
||||
(identical(other.wolCfg, wolCfg) || other.wolCfg == wolCfg) &&
|
||||
const DeepCollectionEquality().equals(other._envs, _envs) &&
|
||||
(identical(other.id, id) || other.id == id));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
name,
|
||||
ip,
|
||||
port,
|
||||
user,
|
||||
pwd,
|
||||
keyId,
|
||||
const DeepCollectionEquality().hash(_tags),
|
||||
alterUrl,
|
||||
autoConnect,
|
||||
jumpId,
|
||||
custom,
|
||||
wolCfg,
|
||||
const DeepCollectionEquality().hash(_envs),
|
||||
id,
|
||||
);
|
||||
|
||||
/// Create a copy of Spi
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SpiImplCopyWith<_$SpiImpl> get copyWith =>
|
||||
__$$SpiImplCopyWithImpl<_$SpiImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$SpiImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Spi extends Spi {
|
||||
const factory _Spi({
|
||||
required final String name,
|
||||
required final String ip,
|
||||
required final int port,
|
||||
required final String user,
|
||||
final String? pwd,
|
||||
@JsonKey(name: 'pubKeyId') final String? keyId,
|
||||
final List<String>? tags,
|
||||
final String? alterUrl,
|
||||
@JsonKey(defaultValue: true) final bool autoConnect,
|
||||
final String? jumpId,
|
||||
final ServerCustom? custom,
|
||||
final WakeOnLanCfg? wolCfg,
|
||||
final Map<String, String>? envs,
|
||||
@JsonKey(fromJson: Spi.parseId)
|
||||
@HiveField(13, defaultValue: '')
|
||||
required final String id,
|
||||
}) = _$SpiImpl;
|
||||
const _Spi._() : super._();
|
||||
|
||||
@override
|
||||
String get name;
|
||||
@override
|
||||
String get ip;
|
||||
@override
|
||||
int get port;
|
||||
@override
|
||||
String get user;
|
||||
@override
|
||||
String? get pwd;
|
||||
|
||||
/// [id] of private key
|
||||
@override
|
||||
@JsonKey(name: 'pubKeyId')
|
||||
String? get keyId;
|
||||
@override
|
||||
List<String>? get tags;
|
||||
@override
|
||||
String? get alterUrl;
|
||||
@override
|
||||
@JsonKey(defaultValue: true)
|
||||
bool get autoConnect;
|
||||
|
||||
/// [id] of the jump server
|
||||
@override
|
||||
String? get jumpId;
|
||||
@override
|
||||
ServerCustom? get custom;
|
||||
@override
|
||||
WakeOnLanCfg? get wolCfg;
|
||||
|
||||
/// It only applies to SSH terminal.
|
||||
@override
|
||||
Map<String, String>? get envs;
|
||||
@override
|
||||
@JsonKey(fromJson: Spi.parseId)
|
||||
@HiveField(13, defaultValue: '')
|
||||
String get id;
|
||||
|
||||
/// Create a copy of Spi
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$SpiImplCopyWith<_$SpiImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
// dart format on
|
||||
|
||||
@@ -6,7 +6,7 @@ part of 'server_private_info.dart';
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
Spi _$SpiFromJson(Map<String, dynamic> json) => Spi(
|
||||
_Spi _$SpiFromJson(Map<String, dynamic> json) => _Spi(
|
||||
name: json['name'] as String,
|
||||
ip: json['ip'] as String,
|
||||
port: (json['port'] as num).toInt(),
|
||||
@@ -26,10 +26,10 @@ Spi _$SpiFromJson(Map<String, dynamic> json) => Spi(
|
||||
envs: (json['envs'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(k, e as String),
|
||||
),
|
||||
id: Spi.parseId(json['id']),
|
||||
id: json['id'] == null ? '' : Spi.parseId(json['id']),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SpiToJson(Spi instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$SpiToJson(_Spi instance) => <String, dynamic>{
|
||||
'name': instance.name,
|
||||
'ip': instance.ip,
|
||||
'port': instance.port,
|
||||
@@ -45,20 +45,3 @@ Map<String, dynamic> _$SpiToJson(Spi instance) => <String, dynamic>{
|
||||
if (instance.envs case final value?) 'envs': value,
|
||||
'id': instance.id,
|
||||
};
|
||||
|
||||
Map<String, dynamic> _$$SpiImplToJson(_$SpiImpl 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,
|
||||
'id': instance.id,
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ part 'snippet.g.dart';
|
||||
part 'snippet.freezed.dart';
|
||||
|
||||
@freezed
|
||||
class Snippet with _$Snippet {
|
||||
abstract class Snippet with _$Snippet {
|
||||
const factory Snippet({
|
||||
required String name,
|
||||
required String script,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
@@ -9,280 +10,170 @@ part of 'snippet.dart';
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
Snippet _$SnippetFromJson(Map<String, dynamic> json) {
|
||||
return _Snippet.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Snippet {
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
String get script => throw _privateConstructorUsedError;
|
||||
List<String>? get tags => throw _privateConstructorUsedError;
|
||||
String? get note => throw _privateConstructorUsedError;
|
||||
|
||||
/// List of server id that this snippet should be auto run on
|
||||
List<String>? get autoRunOn => throw _privateConstructorUsedError;
|
||||
String get name; String get script; List<String>? get tags; String? get note;/// List of server id that this snippet should be auto run on
|
||||
List<String>? get autoRunOn;
|
||||
/// Create a copy of Snippet
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$SnippetCopyWith<Snippet> get copyWith => _$SnippetCopyWithImpl<Snippet>(this as Snippet, _$identity);
|
||||
|
||||
/// Serializes this Snippet to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is Snippet&&(identical(other.name, name) || other.name == name)&&(identical(other.script, script) || other.script == script)&&const DeepCollectionEquality().equals(other.tags, tags)&&(identical(other.note, note) || other.note == note)&&const DeepCollectionEquality().equals(other.autoRunOn, autoRunOn));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,name,script,const DeepCollectionEquality().hash(tags),note,const DeepCollectionEquality().hash(autoRunOn));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Snippet(name: $name, script: $script, tags: $tags, note: $note, autoRunOn: $autoRunOn)';
|
||||
}
|
||||
|
||||
|
||||
/// Create a copy of Snippet
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$SnippetCopyWith<Snippet> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SnippetCopyWith<$Res> {
|
||||
factory $SnippetCopyWith(Snippet value, $Res Function(Snippet) then) =
|
||||
_$SnippetCopyWithImpl<$Res, Snippet>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String name,
|
||||
String script,
|
||||
List<String>? tags,
|
||||
String? note,
|
||||
List<String>? autoRunOn,
|
||||
});
|
||||
}
|
||||
abstract mixin class $SnippetCopyWith<$Res> {
|
||||
factory $SnippetCopyWith(Snippet value, $Res Function(Snippet) _then) = _$SnippetCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String name, String script, List<String>? tags, String? note, List<String>? autoRunOn
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$SnippetCopyWithImpl<$Res, $Val extends Snippet>
|
||||
class _$SnippetCopyWithImpl<$Res>
|
||||
implements $SnippetCopyWith<$Res> {
|
||||
_$SnippetCopyWithImpl(this._value, this._then);
|
||||
_$SnippetCopyWithImpl(this._self, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
final Snippet _self;
|
||||
final $Res Function(Snippet) _then;
|
||||
|
||||
/// Create a copy of Snippet
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = null,
|
||||
Object? script = null,
|
||||
Object? tags = freezed,
|
||||
Object? note = freezed,
|
||||
Object? autoRunOn = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
script: null == script
|
||||
? _value.script
|
||||
: script // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
tags: freezed == tags
|
||||
? _value.tags
|
||||
: tags // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
note: freezed == note
|
||||
? _value.note
|
||||
: note // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
autoRunOn: freezed == autoRunOn
|
||||
? _value.autoRunOn
|
||||
: autoRunOn // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
/// Create a copy of Snippet
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? name = null,Object? script = null,Object? tags = freezed,Object? note = freezed,Object? autoRunOn = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,script: null == script ? _self.script : script // ignore: cast_nullable_to_non_nullable
|
||||
as String,tags: freezed == tags ? _self.tags : tags // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,note: freezed == note ? _self.note : note // ignore: cast_nullable_to_non_nullable
|
||||
as String?,autoRunOn: freezed == autoRunOn ? _self.autoRunOn : autoRunOn // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
));
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SnippetImplCopyWith<$Res> implements $SnippetCopyWith<$Res> {
|
||||
factory _$$SnippetImplCopyWith(
|
||||
_$SnippetImpl value,
|
||||
$Res Function(_$SnippetImpl) then,
|
||||
) = __$$SnippetImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String name,
|
||||
String script,
|
||||
List<String>? tags,
|
||||
String? note,
|
||||
List<String>? autoRunOn,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SnippetImplCopyWithImpl<$Res>
|
||||
extends _$SnippetCopyWithImpl<$Res, _$SnippetImpl>
|
||||
implements _$$SnippetImplCopyWith<$Res> {
|
||||
__$$SnippetImplCopyWithImpl(
|
||||
_$SnippetImpl _value,
|
||||
$Res Function(_$SnippetImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of Snippet
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = null,
|
||||
Object? script = null,
|
||||
Object? tags = freezed,
|
||||
Object? note = freezed,
|
||||
Object? autoRunOn = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_$SnippetImpl(
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
script: null == script
|
||||
? _value.script
|
||||
: script // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
tags: freezed == tags
|
||||
? _value._tags
|
||||
: tags // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
note: freezed == note
|
||||
? _value.note
|
||||
: note // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
autoRunOn: freezed == autoRunOn
|
||||
? _value._autoRunOn
|
||||
: autoRunOn // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$SnippetImpl implements _Snippet {
|
||||
const _$SnippetImpl({
|
||||
required this.name,
|
||||
required this.script,
|
||||
final List<String>? tags,
|
||||
this.note,
|
||||
final List<String>? autoRunOn,
|
||||
}) : _tags = tags,
|
||||
_autoRunOn = autoRunOn;
|
||||
|
||||
factory _$SnippetImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$SnippetImplFromJson(json);
|
||||
class _Snippet implements Snippet {
|
||||
const _Snippet({required this.name, required this.script, final List<String>? tags, this.note, final List<String>? autoRunOn}): _tags = tags,_autoRunOn = autoRunOn;
|
||||
factory _Snippet.fromJson(Map<String, dynamic> json) => _$SnippetFromJson(json);
|
||||
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
final String script;
|
||||
final List<String>? _tags;
|
||||
@override
|
||||
List<String>? get tags {
|
||||
final value = _tags;
|
||||
if (value == null) return null;
|
||||
if (_tags is EqualUnmodifiableListView) return _tags;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
@override
|
||||
final String? note;
|
||||
|
||||
/// List of server id that this snippet should be auto run on
|
||||
final List<String>? _autoRunOn;
|
||||
|
||||
/// List of server id that this snippet should be auto run on
|
||||
@override
|
||||
List<String>? get autoRunOn {
|
||||
final value = _autoRunOn;
|
||||
if (value == null) return null;
|
||||
if (_autoRunOn is EqualUnmodifiableListView) return _autoRunOn;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Snippet(name: $name, script: $script, tags: $tags, note: $note, autoRunOn: $autoRunOn)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SnippetImpl &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.script, script) || other.script == script) &&
|
||||
const DeepCollectionEquality().equals(other._tags, _tags) &&
|
||||
(identical(other.note, note) || other.note == note) &&
|
||||
const DeepCollectionEquality().equals(
|
||||
other._autoRunOn,
|
||||
_autoRunOn,
|
||||
));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
name,
|
||||
script,
|
||||
const DeepCollectionEquality().hash(_tags),
|
||||
note,
|
||||
const DeepCollectionEquality().hash(_autoRunOn),
|
||||
);
|
||||
|
||||
/// Create a copy of Snippet
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SnippetImplCopyWith<_$SnippetImpl> get copyWith =>
|
||||
__$$SnippetImplCopyWithImpl<_$SnippetImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$SnippetImplToJson(this);
|
||||
}
|
||||
@override final String name;
|
||||
@override final String script;
|
||||
final List<String>? _tags;
|
||||
@override List<String>? get tags {
|
||||
final value = _tags;
|
||||
if (value == null) return null;
|
||||
if (_tags is EqualUnmodifiableListView) return _tags;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
abstract class _Snippet implements Snippet {
|
||||
const factory _Snippet({
|
||||
required final String name,
|
||||
required final String script,
|
||||
final List<String>? tags,
|
||||
final String? note,
|
||||
final List<String>? autoRunOn,
|
||||
}) = _$SnippetImpl;
|
||||
|
||||
factory _Snippet.fromJson(Map<String, dynamic> json) = _$SnippetImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get name;
|
||||
@override
|
||||
String get script;
|
||||
@override
|
||||
List<String>? get tags;
|
||||
@override
|
||||
String? get note;
|
||||
|
||||
/// List of server id that this snippet should be auto run on
|
||||
@override
|
||||
List<String>? get autoRunOn;
|
||||
|
||||
/// Create a copy of Snippet
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$SnippetImplCopyWith<_$SnippetImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
@override final String? note;
|
||||
/// List of server id that this snippet should be auto run on
|
||||
final List<String>? _autoRunOn;
|
||||
/// List of server id that this snippet should be auto run on
|
||||
@override List<String>? get autoRunOn {
|
||||
final value = _autoRunOn;
|
||||
if (value == null) return null;
|
||||
if (_autoRunOn is EqualUnmodifiableListView) return _autoRunOn;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
|
||||
/// Create a copy of Snippet
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$SnippetCopyWith<_Snippet> get copyWith => __$SnippetCopyWithImpl<_Snippet>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$SnippetToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Snippet&&(identical(other.name, name) || other.name == name)&&(identical(other.script, script) || other.script == script)&&const DeepCollectionEquality().equals(other._tags, _tags)&&(identical(other.note, note) || other.note == note)&&const DeepCollectionEquality().equals(other._autoRunOn, _autoRunOn));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,name,script,const DeepCollectionEquality().hash(_tags),note,const DeepCollectionEquality().hash(_autoRunOn));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Snippet(name: $name, script: $script, tags: $tags, note: $note, autoRunOn: $autoRunOn)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$SnippetCopyWith<$Res> implements $SnippetCopyWith<$Res> {
|
||||
factory _$SnippetCopyWith(_Snippet value, $Res Function(_Snippet) _then) = __$SnippetCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String name, String script, List<String>? tags, String? note, List<String>? autoRunOn
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$SnippetCopyWithImpl<$Res>
|
||||
implements _$SnippetCopyWith<$Res> {
|
||||
__$SnippetCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Snippet _self;
|
||||
final $Res Function(_Snippet) _then;
|
||||
|
||||
/// Create a copy of Snippet
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? name = null,Object? script = null,Object? tags = freezed,Object? note = freezed,Object? autoRunOn = freezed,}) {
|
||||
return _then(_Snippet(
|
||||
name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,script: null == script ? _self.script : script // ignore: cast_nullable_to_non_nullable
|
||||
as String,tags: freezed == tags ? _self._tags : tags // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,note: freezed == note ? _self.note : note // ignore: cast_nullable_to_non_nullable
|
||||
as String?,autoRunOn: freezed == autoRunOn ? _self._autoRunOn : autoRunOn // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
|
||||
@@ -6,22 +6,20 @@ part of 'snippet.dart';
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$SnippetImpl _$$SnippetImplFromJson(Map<String, dynamic> json) =>
|
||||
_$SnippetImpl(
|
||||
name: json['name'] as String,
|
||||
script: json['script'] as String,
|
||||
tags: (json['tags'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
||||
note: json['note'] as String?,
|
||||
autoRunOn: (json['autoRunOn'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList(),
|
||||
);
|
||||
_Snippet _$SnippetFromJson(Map<String, dynamic> json) => _Snippet(
|
||||
name: json['name'] as String,
|
||||
script: json['script'] as String,
|
||||
tags: (json['tags'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
||||
note: json['note'] as String?,
|
||||
autoRunOn: (json['autoRunOn'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$SnippetImplToJson(_$SnippetImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'name': instance.name,
|
||||
'script': instance.script,
|
||||
'tags': instance.tags,
|
||||
'note': instance.note,
|
||||
'autoRunOn': instance.autoRunOn,
|
||||
};
|
||||
Map<String, dynamic> _$SnippetToJson(_Snippet instance) => <String, dynamic>{
|
||||
'name': instance.name,
|
||||
'script': instance.script,
|
||||
'tags': instance.tags,
|
||||
'note': instance.note,
|
||||
'autoRunOn': instance.autoRunOn,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user