migrate: freezed v3

This commit is contained in:
lollipopkit🏳️‍⚧️
2025-06-10 14:27:27 +08:00
parent 8e7de604ee
commit 66ecb02d9e
14 changed files with 1058 additions and 2200 deletions

View File

@@ -20,7 +20,7 @@ jobs:
uses: subosito/flutter-action@v2 uses: subosito/flutter-action@v2
with: with:
channel: "stable" channel: "stable"
flutter-version: "3.32.1" flutter-version: "3.32.2"
- uses: actions/setup-java@v4 - uses: actions/setup-java@v4
with: with:
distribution: "zulu" distribution: "zulu"

View File

@@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@@ -9,364 +10,196 @@ part of 'backup2.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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',
);
BackupV2 _$BackupV2FromJson(Map<String, dynamic> json) {
return _BackupV2.fromJson(json);
}
/// @nodoc /// @nodoc
mixin _$BackupV2 { mixin _$BackupV2 {
int get version => throw _privateConstructorUsedError;
int get date => throw _privateConstructorUsedError; int get version; int get date; Map<String, Object?> get spis; Map<String, Object?> get snippets; Map<String, Object?> get keys; Map<String, Object?> get container; Map<String, Object?> get history; Map<String, Object?> get settings;
Map<String, Object?> get spis => throw _privateConstructorUsedError; /// Create a copy of BackupV2
Map<String, Object?> get snippets => throw _privateConstructorUsedError; /// with the given fields replaced by the non-null parameter values.
Map<String, Object?> get keys => throw _privateConstructorUsedError; @JsonKey(includeFromJson: false, includeToJson: false)
Map<String, Object?> get container => throw _privateConstructorUsedError; @pragma('vm:prefer-inline')
Map<String, Object?> get history => throw _privateConstructorUsedError; $BackupV2CopyWith<BackupV2> get copyWith => _$BackupV2CopyWithImpl<BackupV2>(this as BackupV2, _$identity);
Map<String, Object?> get settings => throw _privateConstructorUsedError;
/// Serializes this BackupV2 to a JSON map. /// Serializes this BackupV2 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 BackupV2&&(identical(other.version, version) || other.version == version)&&(identical(other.date, date) || other.date == date)&&const DeepCollectionEquality().equals(other.spis, spis)&&const DeepCollectionEquality().equals(other.snippets, snippets)&&const DeepCollectionEquality().equals(other.keys, keys)&&const DeepCollectionEquality().equals(other.container, container)&&const DeepCollectionEquality().equals(other.history, history)&&const DeepCollectionEquality().equals(other.settings, settings));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,version,date,const DeepCollectionEquality().hash(spis),const DeepCollectionEquality().hash(snippets),const DeepCollectionEquality().hash(keys),const DeepCollectionEquality().hash(container),const DeepCollectionEquality().hash(history),const DeepCollectionEquality().hash(settings));
@override
String toString() {
return 'BackupV2(version: $version, date: $date, spis: $spis, snippets: $snippets, keys: $keys, container: $container, history: $history, settings: $settings)';
}
/// Create a copy of BackupV2
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$BackupV2CopyWith<BackupV2> get copyWith =>
throw _privateConstructorUsedError;
} }
/// @nodoc /// @nodoc
abstract class $BackupV2CopyWith<$Res> { abstract mixin class $BackupV2CopyWith<$Res> {
factory $BackupV2CopyWith(BackupV2 value, $Res Function(BackupV2) then) = factory $BackupV2CopyWith(BackupV2 value, $Res Function(BackupV2) _then) = _$BackupV2CopyWithImpl;
_$BackupV2CopyWithImpl<$Res, BackupV2>; @useResult
@useResult $Res call({
$Res call({ int version, int date, Map<String, Object?> spis, Map<String, Object?> snippets, Map<String, Object?> keys, Map<String, Object?> container, Map<String, Object?> history, Map<String, Object?> settings
int version, });
int date,
Map<String, Object?> spis,
Map<String, Object?> snippets,
Map<String, Object?> keys,
Map<String, Object?> container,
Map<String, Object?> history,
Map<String, Object?> settings,
});
}
}
/// @nodoc /// @nodoc
class _$BackupV2CopyWithImpl<$Res, $Val extends BackupV2> class _$BackupV2CopyWithImpl<$Res>
implements $BackupV2CopyWith<$Res> { implements $BackupV2CopyWith<$Res> {
_$BackupV2CopyWithImpl(this._value, this._then); _$BackupV2CopyWithImpl(this._self, this._then);
// ignore: unused_field final BackupV2 _self;
final $Val _value; final $Res Function(BackupV2) _then;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of BackupV2 /// Create a copy of BackupV2
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline') @override $Res call({Object? version = null,Object? date = null,Object? spis = null,Object? snippets = null,Object? keys = null,Object? container = null,Object? history = null,Object? settings = null,}) {
@override return _then(_self.copyWith(
$Res call({ version: null == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
Object? version = null, as int,date: null == date ? _self.date : date // ignore: cast_nullable_to_non_nullable
Object? date = null, as int,spis: null == spis ? _self.spis : spis // ignore: cast_nullable_to_non_nullable
Object? spis = null, as Map<String, Object?>,snippets: null == snippets ? _self.snippets : snippets // ignore: cast_nullable_to_non_nullable
Object? snippets = null, as Map<String, Object?>,keys: null == keys ? _self.keys : keys // ignore: cast_nullable_to_non_nullable
Object? keys = null, as Map<String, Object?>,container: null == container ? _self.container : container // ignore: cast_nullable_to_non_nullable
Object? container = null, as Map<String, Object?>,history: null == history ? _self.history : history // ignore: cast_nullable_to_non_nullable
Object? history = null, as Map<String, Object?>,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable
Object? settings = null, as Map<String, Object?>,
}) { ));
return _then(
_value.copyWith(
version: null == version
? _value.version
: version // ignore: cast_nullable_to_non_nullable
as int,
date: null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as int,
spis: null == spis
? _value.spis
: spis // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,
snippets: null == snippets
? _value.snippets
: snippets // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,
keys: null == keys
? _value.keys
: keys // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,
container: null == container
? _value.container
: container // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,
history: null == history
? _value.history
: history // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,
settings: null == settings
? _value.settings
: settings // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,
)
as $Val,
);
}
} }
/// @nodoc
abstract class _$$BackupV2ImplCopyWith<$Res>
implements $BackupV2CopyWith<$Res> {
factory _$$BackupV2ImplCopyWith(
_$BackupV2Impl value,
$Res Function(_$BackupV2Impl) then,
) = __$$BackupV2ImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
int version,
int date,
Map<String, Object?> spis,
Map<String, Object?> snippets,
Map<String, Object?> keys,
Map<String, Object?> container,
Map<String, Object?> history,
Map<String, Object?> settings,
});
} }
/// @nodoc
class __$$BackupV2ImplCopyWithImpl<$Res>
extends _$BackupV2CopyWithImpl<$Res, _$BackupV2Impl>
implements _$$BackupV2ImplCopyWith<$Res> {
__$$BackupV2ImplCopyWithImpl(
_$BackupV2Impl _value,
$Res Function(_$BackupV2Impl) _then,
) : super(_value, _then);
/// Create a copy of BackupV2
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? version = null,
Object? date = null,
Object? spis = null,
Object? snippets = null,
Object? keys = null,
Object? container = null,
Object? history = null,
Object? settings = null,
}) {
return _then(
_$BackupV2Impl(
version: null == version
? _value.version
: version // ignore: cast_nullable_to_non_nullable
as int,
date: null == date
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as int,
spis: null == spis
? _value._spis
: spis // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,
snippets: null == snippets
? _value._snippets
: snippets // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,
keys: null == keys
? _value._keys
: keys // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,
container: null == container
? _value._container
: container // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,
history: null == history
? _value._history
: history // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,
settings: null == settings
? _value._settings
: settings // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,
),
);
}
}
/// @nodoc /// @nodoc
@JsonSerializable() @JsonSerializable()
class _$BackupV2Impl extends _BackupV2 {
const _$BackupV2Impl({
required this.version,
required this.date,
required final Map<String, Object?> spis,
required final Map<String, Object?> snippets,
required final Map<String, Object?> keys,
required final Map<String, Object?> container,
required final Map<String, Object?> history,
required final Map<String, Object?> settings,
}) : _spis = spis,
_snippets = snippets,
_keys = keys,
_container = container,
_history = history,
_settings = settings,
super._();
factory _$BackupV2Impl.fromJson(Map<String, dynamic> json) => class _BackupV2 extends BackupV2 {
_$$BackupV2ImplFromJson(json); const _BackupV2({required this.version, required this.date, required final Map<String, Object?> spis, required final Map<String, Object?> snippets, required final Map<String, Object?> keys, required final Map<String, Object?> container, required final Map<String, Object?> history, required final Map<String, Object?> settings}): _spis = spis,_snippets = snippets,_keys = keys,_container = container,_history = history,_settings = settings,super._();
factory _BackupV2.fromJson(Map<String, dynamic> json) => _$BackupV2FromJson(json);
@override @override final int version;
final int version; @override final int date;
@override final Map<String, Object?> _spis;
final int date; @override Map<String, Object?> get spis {
final Map<String, Object?> _spis; if (_spis is EqualUnmodifiableMapView) return _spis;
@override // ignore: implicit_dynamic_type
Map<String, Object?> get spis { return EqualUnmodifiableMapView(_spis);
if (_spis is EqualUnmodifiableMapView) return _spis;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_spis);
}
final Map<String, Object?> _snippets;
@override
Map<String, Object?> get snippets {
if (_snippets is EqualUnmodifiableMapView) return _snippets;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_snippets);
}
final Map<String, Object?> _keys;
@override
Map<String, Object?> get keys {
if (_keys is EqualUnmodifiableMapView) return _keys;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_keys);
}
final Map<String, Object?> _container;
@override
Map<String, Object?> get container {
if (_container is EqualUnmodifiableMapView) return _container;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_container);
}
final Map<String, Object?> _history;
@override
Map<String, Object?> get history {
if (_history is EqualUnmodifiableMapView) return _history;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_history);
}
final Map<String, Object?> _settings;
@override
Map<String, Object?> get settings {
if (_settings is EqualUnmodifiableMapView) return _settings;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_settings);
}
@override
String toString() {
return 'BackupV2(version: $version, date: $date, spis: $spis, snippets: $snippets, keys: $keys, container: $container, history: $history, settings: $settings)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$BackupV2Impl &&
(identical(other.version, version) || other.version == version) &&
(identical(other.date, date) || other.date == date) &&
const DeepCollectionEquality().equals(other._spis, _spis) &&
const DeepCollectionEquality().equals(other._snippets, _snippets) &&
const DeepCollectionEquality().equals(other._keys, _keys) &&
const DeepCollectionEquality().equals(
other._container,
_container,
) &&
const DeepCollectionEquality().equals(other._history, _history) &&
const DeepCollectionEquality().equals(other._settings, _settings));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
version,
date,
const DeepCollectionEquality().hash(_spis),
const DeepCollectionEquality().hash(_snippets),
const DeepCollectionEquality().hash(_keys),
const DeepCollectionEquality().hash(_container),
const DeepCollectionEquality().hash(_history),
const DeepCollectionEquality().hash(_settings),
);
/// Create a copy of BackupV2
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$BackupV2ImplCopyWith<_$BackupV2Impl> get copyWith =>
__$$BackupV2ImplCopyWithImpl<_$BackupV2Impl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$BackupV2ImplToJson(this);
}
} }
abstract class _BackupV2 extends BackupV2 { final Map<String, Object?> _snippets;
const factory _BackupV2({ @override Map<String, Object?> get snippets {
required final int version, if (_snippets is EqualUnmodifiableMapView) return _snippets;
required final int date, // ignore: implicit_dynamic_type
required final Map<String, Object?> spis, return EqualUnmodifiableMapView(_snippets);
required final Map<String, Object?> snippets,
required final Map<String, Object?> keys,
required final Map<String, Object?> container,
required final Map<String, Object?> history,
required final Map<String, Object?> settings,
}) = _$BackupV2Impl;
const _BackupV2._() : super._();
factory _BackupV2.fromJson(Map<String, dynamic> json) =
_$BackupV2Impl.fromJson;
@override
int get version;
@override
int get date;
@override
Map<String, Object?> get spis;
@override
Map<String, Object?> get snippets;
@override
Map<String, Object?> get keys;
@override
Map<String, Object?> get container;
@override
Map<String, Object?> get history;
@override
Map<String, Object?> get settings;
/// Create a copy of BackupV2
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$BackupV2ImplCopyWith<_$BackupV2Impl> get copyWith =>
throw _privateConstructorUsedError;
} }
final Map<String, Object?> _keys;
@override Map<String, Object?> get keys {
if (_keys is EqualUnmodifiableMapView) return _keys;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_keys);
}
final Map<String, Object?> _container;
@override Map<String, Object?> get container {
if (_container is EqualUnmodifiableMapView) return _container;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_container);
}
final Map<String, Object?> _history;
@override Map<String, Object?> get history {
if (_history is EqualUnmodifiableMapView) return _history;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_history);
}
final Map<String, Object?> _settings;
@override Map<String, Object?> get settings {
if (_settings is EqualUnmodifiableMapView) return _settings;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_settings);
}
/// Create a copy of BackupV2
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$BackupV2CopyWith<_BackupV2> get copyWith => __$BackupV2CopyWithImpl<_BackupV2>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$BackupV2ToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _BackupV2&&(identical(other.version, version) || other.version == version)&&(identical(other.date, date) || other.date == date)&&const DeepCollectionEquality().equals(other._spis, _spis)&&const DeepCollectionEquality().equals(other._snippets, _snippets)&&const DeepCollectionEquality().equals(other._keys, _keys)&&const DeepCollectionEquality().equals(other._container, _container)&&const DeepCollectionEquality().equals(other._history, _history)&&const DeepCollectionEquality().equals(other._settings, _settings));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,version,date,const DeepCollectionEquality().hash(_spis),const DeepCollectionEquality().hash(_snippets),const DeepCollectionEquality().hash(_keys),const DeepCollectionEquality().hash(_container),const DeepCollectionEquality().hash(_history),const DeepCollectionEquality().hash(_settings));
@override
String toString() {
return 'BackupV2(version: $version, date: $date, spis: $spis, snippets: $snippets, keys: $keys, container: $container, history: $history, settings: $settings)';
}
}
/// @nodoc
abstract mixin class _$BackupV2CopyWith<$Res> implements $BackupV2CopyWith<$Res> {
factory _$BackupV2CopyWith(_BackupV2 value, $Res Function(_BackupV2) _then) = __$BackupV2CopyWithImpl;
@override @useResult
$Res call({
int version, int date, Map<String, Object?> spis, Map<String, Object?> snippets, Map<String, Object?> keys, Map<String, Object?> container, Map<String, Object?> history, Map<String, Object?> settings
});
}
/// @nodoc
class __$BackupV2CopyWithImpl<$Res>
implements _$BackupV2CopyWith<$Res> {
__$BackupV2CopyWithImpl(this._self, this._then);
final _BackupV2 _self;
final $Res Function(_BackupV2) _then;
/// Create a copy of BackupV2
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? version = null,Object? date = null,Object? spis = null,Object? snippets = null,Object? keys = null,Object? container = null,Object? history = null,Object? settings = null,}) {
return _then(_BackupV2(
version: null == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
as int,date: null == date ? _self.date : date // ignore: cast_nullable_to_non_nullable
as int,spis: null == spis ? _self._spis : spis // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,snippets: null == snippets ? _self._snippets : snippets // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,keys: null == keys ? _self._keys : keys // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,container: null == container ? _self._container : container // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,history: null == history ? _self._history : history // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,settings: null == settings ? _self._settings : settings // ignore: cast_nullable_to_non_nullable
as Map<String, Object?>,
));
}
}
// dart format on

View File

@@ -6,26 +6,24 @@ part of 'backup2.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$BackupV2Impl _$$BackupV2ImplFromJson(Map<String, dynamic> json) => _BackupV2 _$BackupV2FromJson(Map<String, dynamic> json) => _BackupV2(
_$BackupV2Impl( version: (json['version'] as num).toInt(),
version: (json['version'] as num).toInt(), date: (json['date'] as num).toInt(),
date: (json['date'] as num).toInt(), spis: json['spis'] as Map<String, dynamic>,
spis: json['spis'] as Map<String, dynamic>, snippets: json['snippets'] as Map<String, dynamic>,
snippets: json['snippets'] as Map<String, dynamic>, keys: json['keys'] as Map<String, dynamic>,
keys: json['keys'] as Map<String, dynamic>, container: json['container'] as Map<String, dynamic>,
container: json['container'] as Map<String, dynamic>, history: json['history'] as Map<String, dynamic>,
history: json['history'] as Map<String, dynamic>, settings: json['settings'] as Map<String, dynamic>,
settings: json['settings'] as Map<String, dynamic>, );
);
Map<String, dynamic> _$$BackupV2ImplToJson(_$BackupV2Impl instance) => Map<String, dynamic> _$BackupV2ToJson(_BackupV2 instance) => <String, dynamic>{
<String, dynamic>{ 'version': instance.version,
'version': instance.version, 'date': instance.date,
'date': instance.date, 'spis': instance.spis,
'spis': instance.spis, 'snippets': instance.snippets,
'snippets': instance.snippets, 'keys': instance.keys,
'keys': instance.keys, 'container': instance.container,
'container': instance.container, 'history': instance.history,
'history': instance.history, 'settings': instance.settings,
'settings': instance.settings, };
};

View File

@@ -7,7 +7,7 @@ part 'disk_smart.freezed.dart';
part 'disk_smart.g.dart'; part 'disk_smart.g.dart';
@freezed @freezed
class DiskSmart with _$DiskSmart { abstract class DiskSmart with _$DiskSmart {
const DiskSmart._(); const DiskSmart._();
const factory DiskSmart({ const factory DiskSmart({
@@ -144,7 +144,7 @@ class DiskSmart with _$DiskSmart {
} }
@freezed @freezed
class SmartAttribute with _$SmartAttribute { abstract class SmartAttribute with _$SmartAttribute {
const SmartAttribute._(); const SmartAttribute._();
const factory SmartAttribute({ const factory SmartAttribute({
@@ -168,7 +168,7 @@ class SmartAttribute with _$SmartAttribute {
} }
@freezed @freezed
class SmartAttributeFlags with _$SmartAttributeFlags { abstract class SmartAttributeFlags with _$SmartAttributeFlags {
const SmartAttributeFlags._(); const SmartAttributeFlags._();
const factory SmartAttributeFlags({ const factory SmartAttributeFlags({

File diff suppressed because it is too large Load Diff

View File

@@ -6,23 +6,21 @@ part of 'disk_smart.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$DiskSmartImpl _$$DiskSmartImplFromJson(Map<String, dynamic> json) => _DiskSmart _$DiskSmartFromJson(Map<String, dynamic> json) => _DiskSmart(
_$DiskSmartImpl( device: json['device'] as String,
device: json['device'] as String, healthy: json['healthy'] as bool?,
healthy: json['healthy'] as bool?, temperature: (json['temperature'] as num?)?.toDouble(),
temperature: (json['temperature'] as num?)?.toDouble(), model: json['model'] as String?,
model: json['model'] as String?, serial: json['serial'] as String?,
serial: json['serial'] as String?, powerOnHours: (json['powerOnHours'] as num?)?.toInt(),
powerOnHours: (json['powerOnHours'] as num?)?.toInt(), powerCycleCount: (json['powerCycleCount'] as num?)?.toInt(),
powerCycleCount: (json['powerCycleCount'] as num?)?.toInt(), rawData: json['rawData'] as Map<String, dynamic>,
rawData: json['rawData'] as Map<String, dynamic>, smartAttributes: (json['smartAttributes'] as Map<String, dynamic>).map(
smartAttributes: (json['smartAttributes'] as Map<String, dynamic>).map( (k, e) => MapEntry(k, SmartAttribute.fromJson(e as Map<String, dynamic>)),
(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>{ <String, dynamic>{
'device': instance.device, 'device': instance.device,
'healthy': instance.healthy, 'healthy': instance.healthy,
@@ -35,8 +33,8 @@ Map<String, dynamic> _$$DiskSmartImplToJson(_$DiskSmartImpl instance) =>
'smartAttributes': instance.smartAttributes, 'smartAttributes': instance.smartAttributes,
}; };
_$SmartAttributeImpl _$$SmartAttributeImplFromJson(Map<String, dynamic> json) => _SmartAttribute _$SmartAttributeFromJson(Map<String, dynamic> json) =>
_$SmartAttributeImpl( _SmartAttribute(
id: (json['id'] as num?)?.toInt(), id: (json['id'] as num?)?.toInt(),
name: json['name'] as String, name: json['name'] as String,
value: (json['value'] as num?)?.toInt(), value: (json['value'] as num?)?.toInt(),
@@ -50,35 +48,33 @@ _$SmartAttributeImpl _$$SmartAttributeImplFromJson(Map<String, dynamic> json) =>
), ),
); );
Map<String, dynamic> _$$SmartAttributeImplToJson( Map<String, dynamic> _$SmartAttributeToJson(_SmartAttribute instance) =>
_$SmartAttributeImpl instance, <String, dynamic>{
) => <String, dynamic>{ 'id': instance.id,
'id': instance.id, 'name': instance.name,
'name': instance.name, 'value': instance.value,
'value': instance.value, 'worst': instance.worst,
'worst': instance.worst, 'thresh': instance.thresh,
'thresh': instance.thresh, 'whenFailed': instance.whenFailed,
'whenFailed': instance.whenFailed, 'rawValue': instance.rawValue,
'rawValue': instance.rawValue, 'rawString': instance.rawString,
'rawString': instance.rawString, 'flags': instance.flags,
'flags': instance.flags, };
};
_$SmartAttributeFlagsImpl _$$SmartAttributeFlagsImplFromJson( _SmartAttributeFlags _$SmartAttributeFlagsFromJson(Map<String, dynamic> json) =>
Map<String, dynamic> json, _SmartAttributeFlags(
) => _$SmartAttributeFlagsImpl( value: (json['value'] as num?)?.toInt(),
value: (json['value'] as num?)?.toInt(), string: json['string'] as String?,
string: json['string'] as String?, prefailure: json['prefailure'] as bool? ?? false,
prefailure: json['prefailure'] as bool? ?? false, updatedOnline: json['updatedOnline'] as bool? ?? false,
updatedOnline: json['updatedOnline'] as bool? ?? false, performance: json['performance'] as bool? ?? false,
performance: json['performance'] as bool? ?? false, errorRate: json['errorRate'] as bool? ?? false,
errorRate: json['errorRate'] as bool? ?? false, eventCount: json['eventCount'] as bool? ?? false,
eventCount: json['eventCount'] as bool? ?? false, autoKeep: json['autoKeep'] as bool? ?? false,
autoKeep: json['autoKeep'] as bool? ?? false, );
);
Map<String, dynamic> _$$SmartAttributeFlagsImplToJson( Map<String, dynamic> _$SmartAttributeFlagsToJson(
_$SmartAttributeFlagsImpl instance, _SmartAttributeFlags instance,
) => <String, dynamic>{ ) => <String, dynamic>{
'value': instance.value, 'value': instance.value,
'string': instance.string, 'string': instance.string,

View File

@@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:fl_lib/fl_lib.dart'; import 'package:fl_lib/fl_lib.dart';
import 'package:freezed_annotation/freezed_annotation.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/app/error.dart';
import 'package:server_box/data/model/server/custom.dart'; import 'package:server_box/data/model/server/custom.dart';
import 'package:server_box/data/model/server/server.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`. /// 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`. /// Nowaday, more fields are added to this class, and it's renamed to `Spi`.
@Freezed(fromJson: false) @freezed
@JsonSerializable(includeIfNull: false) abstract class Spi with _$Spi {
class Spi with _$Spi {
const Spi._(); const Spi._();
@JsonSerializable(includeIfNull: false)
const factory Spi({ const factory Spi({
required String name, required String name,
required String ip, required String ip,
@@ -35,7 +34,7 @@ class Spi with _$Spi {
@JsonKey(name: 'pubKeyId') String? keyId, @JsonKey(name: 'pubKeyId') String? keyId,
List<String>? tags, List<String>? tags,
String? alterUrl, String? alterUrl,
@Default(true) @JsonKey(defaultValue: true) bool autoConnect, @Default(true) bool autoConnect,
/// [id] of the jump server /// [id] of the jump server
String? jumpId, String? jumpId,
@@ -44,7 +43,7 @@ class Spi with _$Spi {
/// It only applies to SSH terminal. /// It only applies to SSH terminal.
Map<String, String>? envs, Map<String, String>? envs,
@JsonKey(fromJson: Spi.parseId) @HiveField(13, defaultValue: '') required String id, @Default('') @JsonKey(fromJson: Spi.parseId) String id,
}) = _Spi; }) = _Spi;
factory Spi.fromJson(Map<String, dynamic> json) => _$SpiFromJson(json); factory Spi.fromJson(Map<String, dynamic> json) => _$SpiFromJson(json);

View File

@@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@@ -9,479 +10,193 @@ part of 'server_private_info.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$Spi { 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 String get name; String get ip; int get port; String get user; String? get pwd;/// [id] of private key
@JsonKey(name: 'pubKeyId') @JsonKey(name: 'pubKeyId') String? get keyId; List<String>? get tags; String? get alterUrl; bool get autoConnect;/// [id] of the jump server
String? get keyId => throw _privateConstructorUsedError; String? get jumpId; ServerCustom? get custom; WakeOnLanCfg? get wolCfg;/// It only applies to SSH terminal.
List<String>? get tags => throw _privateConstructorUsedError; Map<String, String>? get envs;@JsonKey(fromJson: Spi.parseId) String get id;
String? get alterUrl => throw _privateConstructorUsedError; /// Create a copy of Spi
@JsonKey(defaultValue: true) /// with the given fields replaced by the non-null parameter values.
bool get autoConnect => throw _privateConstructorUsedError; @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
/// [id] of the jump server $SpiCopyWith<Spi> get copyWith => _$SpiCopyWithImpl<Spi>(this as Spi, _$identity);
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;
/// Serializes this Spi to a JSON map. /// 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 /// @nodoc
abstract class $SpiCopyWith<$Res> { abstract mixin class $SpiCopyWith<$Res> {
factory $SpiCopyWith(Spi value, $Res Function(Spi) then) = factory $SpiCopyWith(Spi value, $Res Function(Spi) _then) = _$SpiCopyWithImpl;
_$SpiCopyWithImpl<$Res, Spi>; @useResult
@useResult $Res call({
$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
String name, });
String ip,
int port,
String user,
String? pwd,
@JsonKey(name: 'pubKeyId') String? keyId, }
List<String>? tags, /// @nodoc
String? alterUrl, class _$SpiCopyWithImpl<$Res>
@JsonKey(defaultValue: true) bool autoConnect, implements $SpiCopyWith<$Res> {
String? jumpId, _$SpiCopyWithImpl(this._self, this._then);
ServerCustom? custom,
WakeOnLanCfg? wolCfg, final Spi _self;
Map<String, String>? envs, final $Res Function(Spi) _then;
@JsonKey(fromJson: Spi.parseId) @HiveField(13, defaultValue: '') String id,
}); /// 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 /// @nodoc
class _$SpiCopyWithImpl<$Res, $Val extends Spi> implements $SpiCopyWith<$Res> { abstract mixin class _$SpiCopyWith<$Res> implements $SpiCopyWith<$Res> {
_$SpiCopyWithImpl(this._value, this._then); 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 /// @nodoc
abstract class _$$SpiImplCopyWith<$Res> implements $SpiCopyWith<$Res> { class __$SpiCopyWithImpl<$Res>
factory _$$SpiImplCopyWith(_$SpiImpl value, $Res Function(_$SpiImpl) then) = implements _$SpiCopyWith<$Res> {
__$$SpiImplCopyWithImpl<$Res>; __$SpiCopyWithImpl(this._self, this._then);
@override
@useResult final _Spi _self;
$Res call({ final $Res Function(_Spi) _then;
String name,
String ip, /// Create a copy of Spi
int port, /// with the given fields replaced by the non-null parameter values.
String user, @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,}) {
String? pwd, return _then(_Spi(
@JsonKey(name: 'pubKeyId') String? keyId, name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
List<String>? tags, as String,ip: null == ip ? _self.ip : ip // ignore: cast_nullable_to_non_nullable
String? alterUrl, as String,port: null == port ? _self.port : port // ignore: cast_nullable_to_non_nullable
@JsonKey(defaultValue: true) bool autoConnect, as int,user: null == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
String? jumpId, as String,pwd: freezed == pwd ? _self.pwd : pwd // ignore: cast_nullable_to_non_nullable
ServerCustom? custom, as String?,keyId: freezed == keyId ? _self.keyId : keyId // ignore: cast_nullable_to_non_nullable
WakeOnLanCfg? wolCfg, as String?,tags: freezed == tags ? _self._tags : tags // ignore: cast_nullable_to_non_nullable
Map<String, String>? envs, as List<String>?,alterUrl: freezed == alterUrl ? _self.alterUrl : alterUrl // ignore: cast_nullable_to_non_nullable
@JsonKey(fromJson: Spi.parseId) @HiveField(13, defaultValue: '') String id, 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 // dart format on
@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;
}

View File

@@ -6,7 +6,7 @@ part of 'server_private_info.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Spi _$SpiFromJson(Map<String, dynamic> json) => Spi( _Spi _$SpiFromJson(Map<String, dynamic> json) => _Spi(
name: json['name'] as String, name: json['name'] as String,
ip: json['ip'] as String, ip: json['ip'] as String,
port: (json['port'] as num).toInt(), 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( envs: (json['envs'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String), (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, 'name': instance.name,
'ip': instance.ip, 'ip': instance.ip,
'port': instance.port, 'port': instance.port,
@@ -45,20 +45,3 @@ Map<String, dynamic> _$SpiToJson(Spi instance) => <String, dynamic>{
if (instance.envs case final value?) 'envs': value, if (instance.envs case final value?) 'envs': value,
'id': instance.id, '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,
};

View File

@@ -9,7 +9,7 @@ part 'snippet.g.dart';
part 'snippet.freezed.dart'; part 'snippet.freezed.dart';
@freezed @freezed
class Snippet with _$Snippet { abstract class Snippet with _$Snippet {
const factory Snippet({ const factory Snippet({
required String name, required String name,
required String script, required String script,

View File

@@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@@ -9,280 +10,170 @@ part of 'snippet.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$Snippet { 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 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 => throw _privateConstructorUsedError; 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. /// 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 /// @nodoc
abstract class $SnippetCopyWith<$Res> { abstract mixin class $SnippetCopyWith<$Res> {
factory $SnippetCopyWith(Snippet value, $Res Function(Snippet) then) = factory $SnippetCopyWith(Snippet value, $Res Function(Snippet) _then) = _$SnippetCopyWithImpl;
_$SnippetCopyWithImpl<$Res, Snippet>; @useResult
@useResult $Res call({
$Res call({ String name, String script, List<String>? tags, String? note, List<String>? autoRunOn
String name, });
String script,
List<String>? tags,
String? note,
List<String>? autoRunOn,
});
}
}
/// @nodoc /// @nodoc
class _$SnippetCopyWithImpl<$Res, $Val extends Snippet> class _$SnippetCopyWithImpl<$Res>
implements $SnippetCopyWith<$Res> { implements $SnippetCopyWith<$Res> {
_$SnippetCopyWithImpl(this._value, this._then); _$SnippetCopyWithImpl(this._self, this._then);
// ignore: unused_field final Snippet _self;
final $Val _value; final $Res Function(Snippet) _then;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Snippet /// Create a copy of Snippet
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline') @override $Res call({Object? name = null,Object? script = null,Object? tags = freezed,Object? note = freezed,Object? autoRunOn = freezed,}) {
@override return _then(_self.copyWith(
$Res call({ name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
Object? name = null, as String,script: null == script ? _self.script : script // ignore: cast_nullable_to_non_nullable
Object? script = null, as String,tags: freezed == tags ? _self.tags : tags // ignore: cast_nullable_to_non_nullable
Object? tags = freezed, as List<String>?,note: freezed == note ? _self.note : note // ignore: cast_nullable_to_non_nullable
Object? note = freezed, as String?,autoRunOn: freezed == autoRunOn ? _self.autoRunOn : autoRunOn // ignore: cast_nullable_to_non_nullable
Object? autoRunOn = freezed, as List<String>?,
}) { ));
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,
);
}
} }
/// @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 /// @nodoc
@JsonSerializable() @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) => class _Snippet implements Snippet {
_$$SnippetImplFromJson(json); 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 @override final String name;
final String name; @override final String script;
@override final List<String>? _tags;
final String script; @override List<String>? get tags {
final List<String>? _tags; final value = _tags;
@override if (value == null) return null;
List<String>? get tags { if (_tags is EqualUnmodifiableListView) return _tags;
final value = _tags; // ignore: implicit_dynamic_type
if (value == null) return null; return EqualUnmodifiableListView(value);
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);
}
} }
abstract class _Snippet implements Snippet { @override final String? note;
const factory _Snippet({ /// List of server id that this snippet should be auto run on
required final String name, final List<String>? _autoRunOn;
required final String script, /// List of server id that this snippet should be auto run on
final List<String>? tags, @override List<String>? get autoRunOn {
final String? note, final value = _autoRunOn;
final List<String>? autoRunOn, if (value == null) return null;
}) = _$SnippetImpl; if (_autoRunOn is EqualUnmodifiableListView) return _autoRunOn;
// ignore: implicit_dynamic_type
factory _Snippet.fromJson(Map<String, dynamic> json) = _$SnippetImpl.fromJson; return EqualUnmodifiableListView(value);
@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;
} }
/// 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

View File

@@ -6,22 +6,20 @@ part of 'snippet.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$SnippetImpl _$$SnippetImplFromJson(Map<String, dynamic> json) => _Snippet _$SnippetFromJson(Map<String, dynamic> json) => _Snippet(
_$SnippetImpl( name: json['name'] as String,
name: json['name'] as String, script: json['script'] as String,
script: json['script'] as String, tags: (json['tags'] as List<dynamic>?)?.map((e) => e as String).toList(),
tags: (json['tags'] as List<dynamic>?)?.map((e) => e as String).toList(), note: json['note'] as String?,
note: json['note'] as String?, autoRunOn: (json['autoRunOn'] as List<dynamic>?)
autoRunOn: (json['autoRunOn'] as List<dynamic>?) ?.map((e) => e as String)
?.map((e) => e as String) .toList(),
.toList(), );
);
Map<String, dynamic> _$$SnippetImplToJson(_$SnippetImpl instance) => Map<String, dynamic> _$SnippetToJson(_Snippet instance) => <String, dynamic>{
<String, dynamic>{ 'name': instance.name,
'name': instance.name, 'script': instance.script,
'script': instance.script, 'tags': instance.tags,
'tags': instance.tags, 'note': instance.note,
'note': instance.note, 'autoRunOn': instance.autoRunOn,
'autoRunOn': instance.autoRunOn, };
};

View File

@@ -6,7 +6,7 @@ part 'app.g.dart';
part 'app.freezed.dart'; part 'app.freezed.dart';
@freezed @freezed
class AppState with _$AppState { abstract class AppState with _$AppState {
const factory AppState({ const factory AppState({
@Default(false) bool desktopMode, @Default(false) bool desktopMode,
}) = _AppState; }) = _AppState;

View File

@@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@@ -9,140 +10,133 @@ part of 'app.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$AppState { mixin _$AppState {
bool get desktopMode => throw _privateConstructorUsedError;
/// Create a copy of AppState bool get desktopMode;
/// with the given fields replaced by the non-null parameter values. /// Create a copy of AppState
@JsonKey(includeFromJson: false, includeToJson: false) /// with the given fields replaced by the non-null parameter values.
$AppStateCopyWith<AppState> get copyWith => @JsonKey(includeFromJson: false, includeToJson: false)
throw _privateConstructorUsedError; @pragma('vm:prefer-inline')
$AppStateCopyWith<AppState> get copyWith => _$AppStateCopyWithImpl<AppState>(this as AppState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppState&&(identical(other.desktopMode, desktopMode) || other.desktopMode == desktopMode));
}
@override
int get hashCode => Object.hash(runtimeType,desktopMode);
@override
String toString() {
return 'AppState(desktopMode: $desktopMode)';
}
} }
/// @nodoc /// @nodoc
abstract class $AppStateCopyWith<$Res> { abstract mixin class $AppStateCopyWith<$Res> {
factory $AppStateCopyWith(AppState value, $Res Function(AppState) then) = factory $AppStateCopyWith(AppState value, $Res Function(AppState) _then) = _$AppStateCopyWithImpl;
_$AppStateCopyWithImpl<$Res, AppState>; @useResult
@useResult $Res call({
$Res call({bool desktopMode}); bool desktopMode
} });
}
/// @nodoc /// @nodoc
class _$AppStateCopyWithImpl<$Res, $Val extends AppState> class _$AppStateCopyWithImpl<$Res>
implements $AppStateCopyWith<$Res> { implements $AppStateCopyWith<$Res> {
_$AppStateCopyWithImpl(this._value, this._then); _$AppStateCopyWithImpl(this._self, this._then);
// ignore: unused_field final AppState _self;
final $Val _value; final $Res Function(AppState) _then;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of AppState /// Create a copy of AppState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline') @override $Res call({Object? desktopMode = null,}) {
@override return _then(_self.copyWith(
$Res call({Object? desktopMode = null}) { desktopMode: null == desktopMode ? _self.desktopMode : desktopMode // ignore: cast_nullable_to_non_nullable
return _then( as bool,
_value.copyWith( ));
desktopMode: null == desktopMode
? _value.desktopMode
: desktopMode // ignore: cast_nullable_to_non_nullable
as bool,
)
as $Val,
);
}
} }
/// @nodoc
abstract class _$$AppStateImplCopyWith<$Res>
implements $AppStateCopyWith<$Res> {
factory _$$AppStateImplCopyWith(
_$AppStateImpl value,
$Res Function(_$AppStateImpl) then,
) = __$$AppStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({bool desktopMode});
} }
/// @nodoc
class __$$AppStateImplCopyWithImpl<$Res>
extends _$AppStateCopyWithImpl<$Res, _$AppStateImpl>
implements _$$AppStateImplCopyWith<$Res> {
__$$AppStateImplCopyWithImpl(
_$AppStateImpl _value,
$Res Function(_$AppStateImpl) _then,
) : super(_value, _then);
/// Create a copy of AppState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? desktopMode = null}) {
return _then(
_$AppStateImpl(
desktopMode: null == desktopMode
? _value.desktopMode
: desktopMode // ignore: cast_nullable_to_non_nullable
as bool,
),
);
}
}
/// @nodoc /// @nodoc
class _$AppStateImpl implements _AppState {
const _$AppStateImpl({this.desktopMode = false});
@override class _AppState implements AppState {
@JsonKey() const _AppState({this.desktopMode = false});
final bool desktopMode;
@override @override@JsonKey() final bool desktopMode;
String toString() {
return 'AppState(desktopMode: $desktopMode)';
}
@override /// Create a copy of AppState
bool operator ==(Object other) { /// with the given fields replaced by the non-null parameter values.
return identical(this, other) || @override @JsonKey(includeFromJson: false, includeToJson: false)
(other.runtimeType == runtimeType && @pragma('vm:prefer-inline')
other is _$AppStateImpl && _$AppStateCopyWith<_AppState> get copyWith => __$AppStateCopyWithImpl<_AppState>(this, _$identity);
(identical(other.desktopMode, desktopMode) ||
other.desktopMode == desktopMode));
}
@override
int get hashCode => Object.hash(runtimeType, desktopMode);
/// Create a copy of AppState
/// with the given fields replaced by the non-null parameter values. @override
@JsonKey(includeFromJson: false, includeToJson: false) bool operator ==(Object other) {
@override return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppState&&(identical(other.desktopMode, desktopMode) || other.desktopMode == desktopMode));
@pragma('vm:prefer-inline')
_$$AppStateImplCopyWith<_$AppStateImpl> get copyWith =>
__$$AppStateImplCopyWithImpl<_$AppStateImpl>(this, _$identity);
} }
abstract class _AppState implements AppState {
const factory _AppState({final bool desktopMode}) = _$AppStateImpl;
@override @override
bool get desktopMode; int get hashCode => Object.hash(runtimeType,desktopMode);
/// Create a copy of AppState @override
/// with the given fields replaced by the non-null parameter values. String toString() {
@override return 'AppState(desktopMode: $desktopMode)';
@JsonKey(includeFromJson: false, includeToJson: false)
_$$AppStateImplCopyWith<_$AppStateImpl> get copyWith =>
throw _privateConstructorUsedError;
} }
}
/// @nodoc
abstract mixin class _$AppStateCopyWith<$Res> implements $AppStateCopyWith<$Res> {
factory _$AppStateCopyWith(_AppState value, $Res Function(_AppState) _then) = __$AppStateCopyWithImpl;
@override @useResult
$Res call({
bool desktopMode
});
}
/// @nodoc
class __$AppStateCopyWithImpl<$Res>
implements _$AppStateCopyWith<$Res> {
__$AppStateCopyWithImpl(this._self, this._then);
final _AppState _self;
final $Res Function(_AppState) _then;
/// Create a copy of AppState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? desktopMode = null,}) {
return _then(_AppState(
desktopMode: null == desktopMode ? _self.desktopMode : desktopMode // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
// dart format on