refactor(model): freezed 패키지 도입으로 보일러플레이트 제거
- ItemStats, CombatStats, EquipmentItem을 freezed로 마이그레이션 - copyWith, toJson/fromJson 자동 생성 - 세이브 파일 호환성 유지
This commit is contained in:
335
lib/src/core/model/equipment_item.freezed.dart
Normal file
335
lib/src/core/model/equipment_item.freezed.dart
Normal file
@@ -0,0 +1,335 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'equipment_item.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
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',
|
||||
);
|
||||
|
||||
EquipmentItem _$EquipmentItemFromJson(Map<String, dynamic> json) {
|
||||
return _EquipmentItem.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$EquipmentItem {
|
||||
/// 아이템 이름 (예: "Flaming Sword of Doom")
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
|
||||
/// 장착 슬롯
|
||||
@JsonKey(fromJson: _slotFromJson, toJson: _slotToJson)
|
||||
EquipmentSlot get slot => throw _privateConstructorUsedError;
|
||||
|
||||
/// 아이템 레벨
|
||||
int get level => throw _privateConstructorUsedError;
|
||||
|
||||
/// 무게 (STR 기반 휴대 제한용)
|
||||
int get weight => throw _privateConstructorUsedError;
|
||||
|
||||
/// 아이템 스탯 보정치
|
||||
ItemStats get stats => throw _privateConstructorUsedError;
|
||||
|
||||
/// 희귀도
|
||||
@JsonKey(fromJson: _rarityFromJson, toJson: _rarityToJson)
|
||||
ItemRarity get rarity => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this EquipmentItem to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of EquipmentItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$EquipmentItemCopyWith<EquipmentItem> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $EquipmentItemCopyWith<$Res> {
|
||||
factory $EquipmentItemCopyWith(
|
||||
EquipmentItem value,
|
||||
$Res Function(EquipmentItem) then,
|
||||
) = _$EquipmentItemCopyWithImpl<$Res, EquipmentItem>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String name,
|
||||
@JsonKey(fromJson: _slotFromJson, toJson: _slotToJson) EquipmentSlot slot,
|
||||
int level,
|
||||
int weight,
|
||||
ItemStats stats,
|
||||
@JsonKey(fromJson: _rarityFromJson, toJson: _rarityToJson)
|
||||
ItemRarity rarity,
|
||||
});
|
||||
|
||||
$ItemStatsCopyWith<$Res> get stats;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$EquipmentItemCopyWithImpl<$Res, $Val extends EquipmentItem>
|
||||
implements $EquipmentItemCopyWith<$Res> {
|
||||
_$EquipmentItemCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of EquipmentItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = null,
|
||||
Object? slot = null,
|
||||
Object? level = null,
|
||||
Object? weight = null,
|
||||
Object? stats = null,
|
||||
Object? rarity = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
slot: null == slot
|
||||
? _value.slot
|
||||
: slot // ignore: cast_nullable_to_non_nullable
|
||||
as EquipmentSlot,
|
||||
level: null == level
|
||||
? _value.level
|
||||
: level // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
weight: null == weight
|
||||
? _value.weight
|
||||
: weight // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
stats: null == stats
|
||||
? _value.stats
|
||||
: stats // ignore: cast_nullable_to_non_nullable
|
||||
as ItemStats,
|
||||
rarity: null == rarity
|
||||
? _value.rarity
|
||||
: rarity // ignore: cast_nullable_to_non_nullable
|
||||
as ItemRarity,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of EquipmentItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ItemStatsCopyWith<$Res> get stats {
|
||||
return $ItemStatsCopyWith<$Res>(_value.stats, (value) {
|
||||
return _then(_value.copyWith(stats: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$EquipmentItemImplCopyWith<$Res>
|
||||
implements $EquipmentItemCopyWith<$Res> {
|
||||
factory _$$EquipmentItemImplCopyWith(
|
||||
_$EquipmentItemImpl value,
|
||||
$Res Function(_$EquipmentItemImpl) then,
|
||||
) = __$$EquipmentItemImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String name,
|
||||
@JsonKey(fromJson: _slotFromJson, toJson: _slotToJson) EquipmentSlot slot,
|
||||
int level,
|
||||
int weight,
|
||||
ItemStats stats,
|
||||
@JsonKey(fromJson: _rarityFromJson, toJson: _rarityToJson)
|
||||
ItemRarity rarity,
|
||||
});
|
||||
|
||||
@override
|
||||
$ItemStatsCopyWith<$Res> get stats;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$EquipmentItemImplCopyWithImpl<$Res>
|
||||
extends _$EquipmentItemCopyWithImpl<$Res, _$EquipmentItemImpl>
|
||||
implements _$$EquipmentItemImplCopyWith<$Res> {
|
||||
__$$EquipmentItemImplCopyWithImpl(
|
||||
_$EquipmentItemImpl _value,
|
||||
$Res Function(_$EquipmentItemImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of EquipmentItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = null,
|
||||
Object? slot = null,
|
||||
Object? level = null,
|
||||
Object? weight = null,
|
||||
Object? stats = null,
|
||||
Object? rarity = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$EquipmentItemImpl(
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
slot: null == slot
|
||||
? _value.slot
|
||||
: slot // ignore: cast_nullable_to_non_nullable
|
||||
as EquipmentSlot,
|
||||
level: null == level
|
||||
? _value.level
|
||||
: level // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
weight: null == weight
|
||||
? _value.weight
|
||||
: weight // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
stats: null == stats
|
||||
? _value.stats
|
||||
: stats // ignore: cast_nullable_to_non_nullable
|
||||
as ItemStats,
|
||||
rarity: null == rarity
|
||||
? _value.rarity
|
||||
: rarity // ignore: cast_nullable_to_non_nullable
|
||||
as ItemRarity,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$EquipmentItemImpl extends _EquipmentItem {
|
||||
const _$EquipmentItemImpl({
|
||||
required this.name,
|
||||
@JsonKey(fromJson: _slotFromJson, toJson: _slotToJson) required this.slot,
|
||||
required this.level,
|
||||
required this.weight,
|
||||
required this.stats,
|
||||
@JsonKey(fromJson: _rarityFromJson, toJson: _rarityToJson)
|
||||
required this.rarity,
|
||||
}) : super._();
|
||||
|
||||
factory _$EquipmentItemImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$EquipmentItemImplFromJson(json);
|
||||
|
||||
/// 아이템 이름 (예: "Flaming Sword of Doom")
|
||||
@override
|
||||
final String name;
|
||||
|
||||
/// 장착 슬롯
|
||||
@override
|
||||
@JsonKey(fromJson: _slotFromJson, toJson: _slotToJson)
|
||||
final EquipmentSlot slot;
|
||||
|
||||
/// 아이템 레벨
|
||||
@override
|
||||
final int level;
|
||||
|
||||
/// 무게 (STR 기반 휴대 제한용)
|
||||
@override
|
||||
final int weight;
|
||||
|
||||
/// 아이템 스탯 보정치
|
||||
@override
|
||||
final ItemStats stats;
|
||||
|
||||
/// 희귀도
|
||||
@override
|
||||
@JsonKey(fromJson: _rarityFromJson, toJson: _rarityToJson)
|
||||
final ItemRarity rarity;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$EquipmentItemImpl &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.slot, slot) || other.slot == slot) &&
|
||||
(identical(other.level, level) || other.level == level) &&
|
||||
(identical(other.weight, weight) || other.weight == weight) &&
|
||||
(identical(other.stats, stats) || other.stats == stats) &&
|
||||
(identical(other.rarity, rarity) || other.rarity == rarity));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, name, slot, level, weight, stats, rarity);
|
||||
|
||||
/// Create a copy of EquipmentItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$EquipmentItemImplCopyWith<_$EquipmentItemImpl> get copyWith =>
|
||||
__$$EquipmentItemImplCopyWithImpl<_$EquipmentItemImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$EquipmentItemImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _EquipmentItem extends EquipmentItem {
|
||||
const factory _EquipmentItem({
|
||||
required final String name,
|
||||
@JsonKey(fromJson: _slotFromJson, toJson: _slotToJson)
|
||||
required final EquipmentSlot slot,
|
||||
required final int level,
|
||||
required final int weight,
|
||||
required final ItemStats stats,
|
||||
@JsonKey(fromJson: _rarityFromJson, toJson: _rarityToJson)
|
||||
required final ItemRarity rarity,
|
||||
}) = _$EquipmentItemImpl;
|
||||
const _EquipmentItem._() : super._();
|
||||
|
||||
factory _EquipmentItem.fromJson(Map<String, dynamic> json) =
|
||||
_$EquipmentItemImpl.fromJson;
|
||||
|
||||
/// 아이템 이름 (예: "Flaming Sword of Doom")
|
||||
@override
|
||||
String get name;
|
||||
|
||||
/// 장착 슬롯
|
||||
@override
|
||||
@JsonKey(fromJson: _slotFromJson, toJson: _slotToJson)
|
||||
EquipmentSlot get slot;
|
||||
|
||||
/// 아이템 레벨
|
||||
@override
|
||||
int get level;
|
||||
|
||||
/// 무게 (STR 기반 휴대 제한용)
|
||||
@override
|
||||
int get weight;
|
||||
|
||||
/// 아이템 스탯 보정치
|
||||
@override
|
||||
ItemStats get stats;
|
||||
|
||||
/// 희귀도
|
||||
@override
|
||||
@JsonKey(fromJson: _rarityFromJson, toJson: _rarityToJson)
|
||||
ItemRarity get rarity;
|
||||
|
||||
/// Create a copy of EquipmentItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$EquipmentItemImplCopyWith<_$EquipmentItemImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
Reference in New Issue
Block a user