forked from eatvio/eatvio_app
pre merge commit
This commit is contained in:
20
lib/features/plans/models/chosen_plan_model.dart
Normal file
20
lib/features/plans/models/chosen_plan_model.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'chosen_plan_model.freezed.dart';
|
||||
part 'chosen_plan_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class ChosenPlanModel with _$ChosenPlanModel {
|
||||
|
||||
factory ChosenPlanModel({
|
||||
@JsonKey() required int id,
|
||||
@JsonKey(name: 'option_type') required String optionType,
|
||||
@JsonKey(name: 'start_date') required DateTime startDate,
|
||||
@JsonKey(name: 'chat_id') required String chatId,
|
||||
@JsonKey(name: 'plan') required PlanModel plan,
|
||||
|
||||
}) = _ChosenPlanModel;
|
||||
|
||||
factory ChosenPlanModel.fromJson(Map<String, dynamic> json) => _$ChosenPlanModelFromJson(json);
|
||||
}
|
||||
283
lib/features/plans/models/chosen_plan_model.freezed.dart
Normal file
283
lib/features/plans/models/chosen_plan_model.freezed.dart
Normal file
@@ -0,0 +1,283 @@
|
||||
// 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 'chosen_plan_model.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');
|
||||
|
||||
ChosenPlanModel _$ChosenPlanModelFromJson(Map<String, dynamic> json) {
|
||||
return _ChosenPlanModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ChosenPlanModel {
|
||||
@JsonKey()
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'option_type')
|
||||
String get optionType => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'start_date')
|
||||
DateTime get startDate => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'chat_id')
|
||||
String get chatId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'plan')
|
||||
PlanModel get plan => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this ChosenPlanModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of ChosenPlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ChosenPlanModelCopyWith<ChosenPlanModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ChosenPlanModelCopyWith<$Res> {
|
||||
factory $ChosenPlanModelCopyWith(
|
||||
ChosenPlanModel value, $Res Function(ChosenPlanModel) then) =
|
||||
_$ChosenPlanModelCopyWithImpl<$Res, ChosenPlanModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey() int id,
|
||||
@JsonKey(name: 'option_type') String optionType,
|
||||
@JsonKey(name: 'start_date') DateTime startDate,
|
||||
@JsonKey(name: 'chat_id') String chatId,
|
||||
@JsonKey(name: 'plan') PlanModel plan});
|
||||
|
||||
$PlanModelCopyWith<$Res> get plan;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ChosenPlanModelCopyWithImpl<$Res, $Val extends ChosenPlanModel>
|
||||
implements $ChosenPlanModelCopyWith<$Res> {
|
||||
_$ChosenPlanModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ChosenPlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? optionType = null,
|
||||
Object? startDate = null,
|
||||
Object? chatId = null,
|
||||
Object? plan = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
optionType: null == optionType
|
||||
? _value.optionType
|
||||
: optionType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
startDate: null == startDate
|
||||
? _value.startDate
|
||||
: startDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
chatId: null == chatId
|
||||
? _value.chatId
|
||||
: chatId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
plan: null == plan
|
||||
? _value.plan
|
||||
: plan // ignore: cast_nullable_to_non_nullable
|
||||
as PlanModel,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
/// Create a copy of ChosenPlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$PlanModelCopyWith<$Res> get plan {
|
||||
return $PlanModelCopyWith<$Res>(_value.plan, (value) {
|
||||
return _then(_value.copyWith(plan: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ChosenPlanModelImplCopyWith<$Res>
|
||||
implements $ChosenPlanModelCopyWith<$Res> {
|
||||
factory _$$ChosenPlanModelImplCopyWith(_$ChosenPlanModelImpl value,
|
||||
$Res Function(_$ChosenPlanModelImpl) then) =
|
||||
__$$ChosenPlanModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey() int id,
|
||||
@JsonKey(name: 'option_type') String optionType,
|
||||
@JsonKey(name: 'start_date') DateTime startDate,
|
||||
@JsonKey(name: 'chat_id') String chatId,
|
||||
@JsonKey(name: 'plan') PlanModel plan});
|
||||
|
||||
@override
|
||||
$PlanModelCopyWith<$Res> get plan;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ChosenPlanModelImplCopyWithImpl<$Res>
|
||||
extends _$ChosenPlanModelCopyWithImpl<$Res, _$ChosenPlanModelImpl>
|
||||
implements _$$ChosenPlanModelImplCopyWith<$Res> {
|
||||
__$$ChosenPlanModelImplCopyWithImpl(
|
||||
_$ChosenPlanModelImpl _value, $Res Function(_$ChosenPlanModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ChosenPlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? optionType = null,
|
||||
Object? startDate = null,
|
||||
Object? chatId = null,
|
||||
Object? plan = null,
|
||||
}) {
|
||||
return _then(_$ChosenPlanModelImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
optionType: null == optionType
|
||||
? _value.optionType
|
||||
: optionType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
startDate: null == startDate
|
||||
? _value.startDate
|
||||
: startDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
chatId: null == chatId
|
||||
? _value.chatId
|
||||
: chatId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
plan: null == plan
|
||||
? _value.plan
|
||||
: plan // ignore: cast_nullable_to_non_nullable
|
||||
as PlanModel,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$ChosenPlanModelImpl implements _ChosenPlanModel {
|
||||
_$ChosenPlanModelImpl(
|
||||
{@JsonKey() required this.id,
|
||||
@JsonKey(name: 'option_type') required this.optionType,
|
||||
@JsonKey(name: 'start_date') required this.startDate,
|
||||
@JsonKey(name: 'chat_id') required this.chatId,
|
||||
@JsonKey(name: 'plan') required this.plan});
|
||||
|
||||
factory _$ChosenPlanModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$ChosenPlanModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey()
|
||||
final int id;
|
||||
@override
|
||||
@JsonKey(name: 'option_type')
|
||||
final String optionType;
|
||||
@override
|
||||
@JsonKey(name: 'start_date')
|
||||
final DateTime startDate;
|
||||
@override
|
||||
@JsonKey(name: 'chat_id')
|
||||
final String chatId;
|
||||
@override
|
||||
@JsonKey(name: 'plan')
|
||||
final PlanModel plan;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ChosenPlanModel(id: $id, optionType: $optionType, startDate: $startDate, chatId: $chatId, plan: $plan)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ChosenPlanModelImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.optionType, optionType) ||
|
||||
other.optionType == optionType) &&
|
||||
(identical(other.startDate, startDate) ||
|
||||
other.startDate == startDate) &&
|
||||
(identical(other.chatId, chatId) || other.chatId == chatId) &&
|
||||
(identical(other.plan, plan) || other.plan == plan));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, id, optionType, startDate, chatId, plan);
|
||||
|
||||
/// Create a copy of ChosenPlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ChosenPlanModelImplCopyWith<_$ChosenPlanModelImpl> get copyWith =>
|
||||
__$$ChosenPlanModelImplCopyWithImpl<_$ChosenPlanModelImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$ChosenPlanModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ChosenPlanModel implements ChosenPlanModel {
|
||||
factory _ChosenPlanModel(
|
||||
{@JsonKey() required final int id,
|
||||
@JsonKey(name: 'option_type') required final String optionType,
|
||||
@JsonKey(name: 'start_date') required final DateTime startDate,
|
||||
@JsonKey(name: 'chat_id') required final String chatId,
|
||||
@JsonKey(name: 'plan') required final PlanModel plan}) =
|
||||
_$ChosenPlanModelImpl;
|
||||
|
||||
factory _ChosenPlanModel.fromJson(Map<String, dynamic> json) =
|
||||
_$ChosenPlanModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey()
|
||||
int get id;
|
||||
@override
|
||||
@JsonKey(name: 'option_type')
|
||||
String get optionType;
|
||||
@override
|
||||
@JsonKey(name: 'start_date')
|
||||
DateTime get startDate;
|
||||
@override
|
||||
@JsonKey(name: 'chat_id')
|
||||
String get chatId;
|
||||
@override
|
||||
@JsonKey(name: 'plan')
|
||||
PlanModel get plan;
|
||||
|
||||
/// Create a copy of ChosenPlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ChosenPlanModelImplCopyWith<_$ChosenPlanModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
27
lib/features/plans/models/chosen_plan_model.g.dart
Normal file
27
lib/features/plans/models/chosen_plan_model.g.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'chosen_plan_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$ChosenPlanModelImpl _$$ChosenPlanModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$ChosenPlanModelImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
optionType: json['option_type'] as String,
|
||||
startDate: DateTime.parse(json['start_date'] as String),
|
||||
chatId: json['chat_id'] as String,
|
||||
plan: PlanModel.fromJson(json['plan'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ChosenPlanModelImplToJson(
|
||||
_$ChosenPlanModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'option_type': instance.optionType,
|
||||
'start_date': instance.startDate.toIso8601String(),
|
||||
'chat_id': instance.chatId,
|
||||
'plan': instance.plan,
|
||||
};
|
||||
Reference in New Issue
Block a user