forked from eatvio/eatvio_app
feat(diary): add diary page, calendar, meals
This commit is contained in:
80
lib/features/diary/models/diary_day_model.dart
Normal file
80
lib/features/diary/models/diary_day_model.dart
Normal file
@@ -0,0 +1,80 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'diary_day_model.freezed.dart';
|
||||
|
||||
part 'diary_day_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class DiaryDayWrapperModel with _$DiaryDayWrapperModel {
|
||||
const factory DiaryDayWrapperModel({
|
||||
@JsonKey(name: "diary") required DiaryDayModel diary,
|
||||
}) = _DiaryDayWrapperModel;
|
||||
|
||||
factory DiaryDayWrapperModel.fromJson(Map<String, dynamic> json) => _$DiaryDayWrapperModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class DiaryDayModel with _$DiaryDayModel {
|
||||
const factory DiaryDayModel({
|
||||
@JsonKey(name: "id") required int id,
|
||||
@JsonKey(name: "date") required String date,
|
||||
@JsonKey(name: "wakeup") String? wakeup,
|
||||
@JsonKey(name: "retire") String? retire,
|
||||
@JsonKey(name: "closed") required int closed,
|
||||
@JsonKey(name: "comment") required String comment,
|
||||
@JsonKey(name: "state") required TypeOfDiaryModel typeOfDiary,
|
||||
@JsonKey(name: "meals") required List<MealModel> meals,
|
||||
}) = _DiaryDayModel;
|
||||
|
||||
factory DiaryDayModel.fromJson(Map<String, dynamic> json) => _$DiaryDayModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class MealModel with _$MealModel {
|
||||
const factory MealModel({
|
||||
@JsonKey(name: "id") required int id,
|
||||
@JsonKey(name: "time") required String time,
|
||||
@JsonKey(name: "type") required int type,
|
||||
@JsonKey(name: "satiety") required int satiety,
|
||||
@JsonKey(name: "mood") required int mood,
|
||||
@JsonKey(name: "portions") required List<Portion> portions,
|
||||
@JsonKey(name: "photos") required List<DiaryPhotoModel> photos,
|
||||
}) = _MealModel;
|
||||
|
||||
factory MealModel.fromJson(Map<String, dynamic> json) => _$MealModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class DiaryPhotoModel with _$DiaryPhotoModel {
|
||||
const factory DiaryPhotoModel({
|
||||
@JsonKey(name: "id") required String id,
|
||||
@JsonKey(name: "original_name") required String originalName,
|
||||
@JsonKey(name: "path") required String path,
|
||||
@JsonKey(name: "size") required String size,
|
||||
}) = _DiaryPhotoModel;
|
||||
|
||||
factory DiaryPhotoModel.fromJson(Map<String, dynamic> json) => _$DiaryPhotoModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Portion with _$Portion {
|
||||
const factory Portion({
|
||||
@JsonKey(name: "id") required int id,
|
||||
@JsonKey(name: "product_name") required String productName,
|
||||
@JsonKey(name: "quantity") required int quantity,
|
||||
@JsonKey(name: "portion") required String portion,
|
||||
@JsonKey(name: "from_diet") required bool fromDiet,
|
||||
}) = _Portion;
|
||||
|
||||
factory Portion.fromJson(Map<String, dynamic> json) => _$PortionFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class TypeOfDiaryModel with _$TypeOfDiaryModel {
|
||||
const factory TypeOfDiaryModel({
|
||||
@JsonKey(name: "has_chosen_diet") required bool hasChosenDiet,
|
||||
@JsonKey(name: "has_chosen_plan") required bool hasChosenPlan,
|
||||
}) = _TypeOfDiaryModel;
|
||||
|
||||
factory TypeOfDiaryModel.fromJson(Map<String, dynamic> json) => _$TypeOfDiaryModelFromJson(json);
|
||||
}
|
||||
1504
lib/features/diary/models/diary_day_model.freezed.dart
Normal file
1504
lib/features/diary/models/diary_day_model.freezed.dart
Normal file
File diff suppressed because it is too large
Load Diff
122
lib/features/diary/models/diary_day_model.g.dart
Normal file
122
lib/features/diary/models/diary_day_model.g.dart
Normal file
@@ -0,0 +1,122 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'diary_day_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$DiaryDayWrapperModelImpl _$$DiaryDayWrapperModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$DiaryDayWrapperModelImpl(
|
||||
diary: DiaryDayModel.fromJson(json['diary'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$DiaryDayWrapperModelImplToJson(
|
||||
_$DiaryDayWrapperModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'diary': instance.diary,
|
||||
};
|
||||
|
||||
_$DiaryDayModelImpl _$$DiaryDayModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$DiaryDayModelImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
date: json['date'] as String,
|
||||
wakeup: json['wakeup'] as String?,
|
||||
retire: json['retire'] as String?,
|
||||
closed: (json['closed'] as num).toInt(),
|
||||
comment: json['comment'] as String,
|
||||
typeOfDiary:
|
||||
TypeOfDiaryModel.fromJson(json['state'] as Map<String, dynamic>),
|
||||
meals: (json['meals'] as List<dynamic>)
|
||||
.map((e) => MealModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$DiaryDayModelImplToJson(_$DiaryDayModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'date': instance.date,
|
||||
'wakeup': instance.wakeup,
|
||||
'retire': instance.retire,
|
||||
'closed': instance.closed,
|
||||
'comment': instance.comment,
|
||||
'state': instance.typeOfDiary,
|
||||
'meals': instance.meals,
|
||||
};
|
||||
|
||||
_$MealModelImpl _$$MealModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$MealModelImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
time: json['time'] as String,
|
||||
type: (json['type'] as num).toInt(),
|
||||
satiety: (json['satiety'] as num).toInt(),
|
||||
mood: (json['mood'] as num).toInt(),
|
||||
portions: (json['portions'] as List<dynamic>)
|
||||
.map((e) => Portion.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
photos: (json['photos'] as List<dynamic>)
|
||||
.map((e) => DiaryPhotoModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$MealModelImplToJson(_$MealModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'time': instance.time,
|
||||
'type': instance.type,
|
||||
'satiety': instance.satiety,
|
||||
'mood': instance.mood,
|
||||
'portions': instance.portions,
|
||||
'photos': instance.photos,
|
||||
};
|
||||
|
||||
_$DiaryPhotoModelImpl _$$DiaryPhotoModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$DiaryPhotoModelImpl(
|
||||
id: json['id'] as String,
|
||||
originalName: json['original_name'] as String,
|
||||
path: json['path'] as String,
|
||||
size: json['size'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$DiaryPhotoModelImplToJson(
|
||||
_$DiaryPhotoModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'original_name': instance.originalName,
|
||||
'path': instance.path,
|
||||
'size': instance.size,
|
||||
};
|
||||
|
||||
_$PortionImpl _$$PortionImplFromJson(Map<String, dynamic> json) =>
|
||||
_$PortionImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
productName: json['product_name'] as String,
|
||||
quantity: (json['quantity'] as num).toInt(),
|
||||
portion: json['portion'] as String,
|
||||
fromDiet: json['from_diet'] as bool,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$PortionImplToJson(_$PortionImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'product_name': instance.productName,
|
||||
'quantity': instance.quantity,
|
||||
'portion': instance.portion,
|
||||
'from_diet': instance.fromDiet,
|
||||
};
|
||||
|
||||
_$TypeOfDiaryModelImpl _$$TypeOfDiaryModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$TypeOfDiaryModelImpl(
|
||||
hasChosenDiet: json['has_chosen_diet'] as bool,
|
||||
hasChosenPlan: json['has_chosen_plan'] as bool,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$TypeOfDiaryModelImplToJson(
|
||||
_$TypeOfDiaryModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'has_chosen_diet': instance.hasChosenDiet,
|
||||
'has_chosen_plan': instance.hasChosenPlan,
|
||||
};
|
||||
14
lib/features/diary/models/diary_index_model.dart
Normal file
14
lib/features/diary/models/diary_index_model.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'diary_index_model.freezed.dart';
|
||||
|
||||
part 'diary_index_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class DiaryIndexModel with _$DiaryIndexModel {
|
||||
const factory DiaryIndexModel({
|
||||
required int id,
|
||||
}) = _DiaryIndexModel;
|
||||
|
||||
factory DiaryIndexModel.fromJson(Map<String, Object?> json) => _$DiaryIndexModelFromJson(json);
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// 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 'product.dart';
|
||||
part of 'diary_index_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
@@ -14,164 +14,153 @@ 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');
|
||||
|
||||
Product _$ProductFromJson(Map<String, dynamic> json) {
|
||||
return _Product.fromJson(json);
|
||||
DiaryIndexModel _$DiaryIndexModelFromJson(Map<String, dynamic> json) {
|
||||
return _DiaryIndexModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Product {
|
||||
mixin _$DiaryIndexModel {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this Product to a JSON map.
|
||||
/// Serializes this DiaryIndexModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of Product
|
||||
/// Create a copy of DiaryIndexModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ProductCopyWith<Product> get copyWith => throw _privateConstructorUsedError;
|
||||
$DiaryIndexModelCopyWith<DiaryIndexModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ProductCopyWith<$Res> {
|
||||
factory $ProductCopyWith(Product value, $Res Function(Product) then) =
|
||||
_$ProductCopyWithImpl<$Res, Product>;
|
||||
abstract class $DiaryIndexModelCopyWith<$Res> {
|
||||
factory $DiaryIndexModelCopyWith(
|
||||
DiaryIndexModel value, $Res Function(DiaryIndexModel) then) =
|
||||
_$DiaryIndexModelCopyWithImpl<$Res, DiaryIndexModel>;
|
||||
@useResult
|
||||
$Res call({int id, String name});
|
||||
$Res call({int id});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ProductCopyWithImpl<$Res, $Val extends Product>
|
||||
implements $ProductCopyWith<$Res> {
|
||||
_$ProductCopyWithImpl(this._value, this._then);
|
||||
class _$DiaryIndexModelCopyWithImpl<$Res, $Val extends DiaryIndexModel>
|
||||
implements $DiaryIndexModelCopyWith<$Res> {
|
||||
_$DiaryIndexModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of Product
|
||||
/// Create a copy of DiaryIndexModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? name = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProductImplCopyWith<$Res> implements $ProductCopyWith<$Res> {
|
||||
factory _$$ProductImplCopyWith(
|
||||
_$ProductImpl value, $Res Function(_$ProductImpl) then) =
|
||||
__$$ProductImplCopyWithImpl<$Res>;
|
||||
abstract class _$$DiaryIndexModelImplCopyWith<$Res>
|
||||
implements $DiaryIndexModelCopyWith<$Res> {
|
||||
factory _$$DiaryIndexModelImplCopyWith(_$DiaryIndexModelImpl value,
|
||||
$Res Function(_$DiaryIndexModelImpl) then) =
|
||||
__$$DiaryIndexModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({int id, String name});
|
||||
$Res call({int id});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProductImplCopyWithImpl<$Res>
|
||||
extends _$ProductCopyWithImpl<$Res, _$ProductImpl>
|
||||
implements _$$ProductImplCopyWith<$Res> {
|
||||
__$$ProductImplCopyWithImpl(
|
||||
_$ProductImpl _value, $Res Function(_$ProductImpl) _then)
|
||||
class __$$DiaryIndexModelImplCopyWithImpl<$Res>
|
||||
extends _$DiaryIndexModelCopyWithImpl<$Res, _$DiaryIndexModelImpl>
|
||||
implements _$$DiaryIndexModelImplCopyWith<$Res> {
|
||||
__$$DiaryIndexModelImplCopyWithImpl(
|
||||
_$DiaryIndexModelImpl _value, $Res Function(_$DiaryIndexModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of Product
|
||||
/// Create a copy of DiaryIndexModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? name = null,
|
||||
}) {
|
||||
return _then(_$ProductImpl(
|
||||
return _then(_$DiaryIndexModelImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$ProductImpl implements _Product {
|
||||
const _$ProductImpl({required this.id, required this.name});
|
||||
class _$DiaryIndexModelImpl implements _DiaryIndexModel {
|
||||
const _$DiaryIndexModelImpl({required this.id});
|
||||
|
||||
factory _$ProductImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$ProductImplFromJson(json);
|
||||
factory _$DiaryIndexModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$DiaryIndexModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
final String name;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Product(id: $id, name: $name)';
|
||||
return 'DiaryIndexModel(id: $id)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ProductImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.name, name) || other.name == name));
|
||||
other is _$DiaryIndexModelImpl &&
|
||||
(identical(other.id, id) || other.id == id));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, id, name);
|
||||
int get hashCode => Object.hash(runtimeType, id);
|
||||
|
||||
/// Create a copy of Product
|
||||
/// Create a copy of DiaryIndexModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ProductImplCopyWith<_$ProductImpl> get copyWith =>
|
||||
__$$ProductImplCopyWithImpl<_$ProductImpl>(this, _$identity);
|
||||
_$$DiaryIndexModelImplCopyWith<_$DiaryIndexModelImpl> get copyWith =>
|
||||
__$$DiaryIndexModelImplCopyWithImpl<_$DiaryIndexModelImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$ProductImplToJson(
|
||||
return _$$DiaryIndexModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Product implements Product {
|
||||
const factory _Product({required final int id, required final String name}) =
|
||||
_$ProductImpl;
|
||||
abstract class _DiaryIndexModel implements DiaryIndexModel {
|
||||
const factory _DiaryIndexModel({required final int id}) =
|
||||
_$DiaryIndexModelImpl;
|
||||
|
||||
factory _Product.fromJson(Map<String, dynamic> json) = _$ProductImpl.fromJson;
|
||||
factory _DiaryIndexModel.fromJson(Map<String, dynamic> json) =
|
||||
_$DiaryIndexModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get id;
|
||||
@override
|
||||
String get name;
|
||||
|
||||
/// Create a copy of Product
|
||||
/// Create a copy of DiaryIndexModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ProductImplCopyWith<_$ProductImpl> get copyWith =>
|
||||
_$$DiaryIndexModelImplCopyWith<_$DiaryIndexModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'product.dart';
|
||||
part of 'diary_index_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$ProductImpl _$$ProductImplFromJson(Map<String, dynamic> json) =>
|
||||
_$ProductImpl(
|
||||
_$DiaryIndexModelImpl _$$DiaryIndexModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$DiaryIndexModelImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
name: json['name'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ProductImplToJson(_$ProductImpl instance) =>
|
||||
Map<String, dynamic> _$$DiaryIndexModelImplToJson(
|
||||
_$DiaryIndexModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
};
|
||||
@@ -1,24 +0,0 @@
|
||||
import 'package:eatvio_app/features/diary/models/state.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import './meal.dart';
|
||||
|
||||
part 'diary_model.freezed.dart';
|
||||
|
||||
part 'diary_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class DiaryModel with _$DiaryModel {
|
||||
const factory DiaryModel({
|
||||
required int id,
|
||||
required DateTime date,
|
||||
required int closed,
|
||||
required List<Meal> meals,
|
||||
required State state,
|
||||
String? comment,
|
||||
DateTime? wakeup,
|
||||
DateTime? retire,
|
||||
}) = _DiaryModel;
|
||||
|
||||
factory DiaryModel.fromJson(Map<String, Object?> json) => _$DiaryModelFromJson(json);
|
||||
}
|
||||
@@ -1,339 +0,0 @@
|
||||
// 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 'diary_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');
|
||||
|
||||
DiaryModel _$DiaryModelFromJson(Map<String, dynamic> json) {
|
||||
return _DiaryModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$DiaryModel {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
DateTime get date => throw _privateConstructorUsedError;
|
||||
int get closed => throw _privateConstructorUsedError;
|
||||
List<Meal> get meals => throw _privateConstructorUsedError;
|
||||
State get state => throw _privateConstructorUsedError;
|
||||
String? get comment => throw _privateConstructorUsedError;
|
||||
DateTime? get wakeup => throw _privateConstructorUsedError;
|
||||
DateTime? get retire => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this DiaryModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of DiaryModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$DiaryModelCopyWith<DiaryModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $DiaryModelCopyWith<$Res> {
|
||||
factory $DiaryModelCopyWith(
|
||||
DiaryModel value, $Res Function(DiaryModel) then) =
|
||||
_$DiaryModelCopyWithImpl<$Res, DiaryModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
DateTime date,
|
||||
int closed,
|
||||
List<Meal> meals,
|
||||
State state,
|
||||
String? comment,
|
||||
DateTime? wakeup,
|
||||
DateTime? retire});
|
||||
|
||||
$StateCopyWith<$Res> get state;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel>
|
||||
implements $DiaryModelCopyWith<$Res> {
|
||||
_$DiaryModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of DiaryModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? date = null,
|
||||
Object? closed = null,
|
||||
Object? meals = null,
|
||||
Object? state = null,
|
||||
Object? comment = freezed,
|
||||
Object? wakeup = freezed,
|
||||
Object? retire = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
date: null == date
|
||||
? _value.date
|
||||
: date // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
closed: null == closed
|
||||
? _value.closed
|
||||
: closed // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
meals: null == meals
|
||||
? _value.meals
|
||||
: meals // ignore: cast_nullable_to_non_nullable
|
||||
as List<Meal>,
|
||||
state: null == state
|
||||
? _value.state
|
||||
: state // ignore: cast_nullable_to_non_nullable
|
||||
as State,
|
||||
comment: freezed == comment
|
||||
? _value.comment
|
||||
: comment // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
wakeup: freezed == wakeup
|
||||
? _value.wakeup
|
||||
: wakeup // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
retire: freezed == retire
|
||||
? _value.retire
|
||||
: retire // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
/// Create a copy of DiaryModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$StateCopyWith<$Res> get state {
|
||||
return $StateCopyWith<$Res>(_value.state, (value) {
|
||||
return _then(_value.copyWith(state: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$DiaryModelImplCopyWith<$Res>
|
||||
implements $DiaryModelCopyWith<$Res> {
|
||||
factory _$$DiaryModelImplCopyWith(
|
||||
_$DiaryModelImpl value, $Res Function(_$DiaryModelImpl) then) =
|
||||
__$$DiaryModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
DateTime date,
|
||||
int closed,
|
||||
List<Meal> meals,
|
||||
State state,
|
||||
String? comment,
|
||||
DateTime? wakeup,
|
||||
DateTime? retire});
|
||||
|
||||
@override
|
||||
$StateCopyWith<$Res> get state;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$DiaryModelImplCopyWithImpl<$Res>
|
||||
extends _$DiaryModelCopyWithImpl<$Res, _$DiaryModelImpl>
|
||||
implements _$$DiaryModelImplCopyWith<$Res> {
|
||||
__$$DiaryModelImplCopyWithImpl(
|
||||
_$DiaryModelImpl _value, $Res Function(_$DiaryModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of DiaryModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? date = null,
|
||||
Object? closed = null,
|
||||
Object? meals = null,
|
||||
Object? state = null,
|
||||
Object? comment = freezed,
|
||||
Object? wakeup = freezed,
|
||||
Object? retire = freezed,
|
||||
}) {
|
||||
return _then(_$DiaryModelImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
date: null == date
|
||||
? _value.date
|
||||
: date // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
closed: null == closed
|
||||
? _value.closed
|
||||
: closed // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
meals: null == meals
|
||||
? _value._meals
|
||||
: meals // ignore: cast_nullable_to_non_nullable
|
||||
as List<Meal>,
|
||||
state: null == state
|
||||
? _value.state
|
||||
: state // ignore: cast_nullable_to_non_nullable
|
||||
as State,
|
||||
comment: freezed == comment
|
||||
? _value.comment
|
||||
: comment // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
wakeup: freezed == wakeup
|
||||
? _value.wakeup
|
||||
: wakeup // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
retire: freezed == retire
|
||||
? _value.retire
|
||||
: retire // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$DiaryModelImpl implements _DiaryModel {
|
||||
const _$DiaryModelImpl(
|
||||
{required this.id,
|
||||
required this.date,
|
||||
required this.closed,
|
||||
required final List<Meal> meals,
|
||||
required this.state,
|
||||
this.comment,
|
||||
this.wakeup,
|
||||
this.retire})
|
||||
: _meals = meals;
|
||||
|
||||
factory _$DiaryModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$DiaryModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
final DateTime date;
|
||||
@override
|
||||
final int closed;
|
||||
final List<Meal> _meals;
|
||||
@override
|
||||
List<Meal> get meals {
|
||||
if (_meals is EqualUnmodifiableListView) return _meals;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_meals);
|
||||
}
|
||||
|
||||
@override
|
||||
final State state;
|
||||
@override
|
||||
final String? comment;
|
||||
@override
|
||||
final DateTime? wakeup;
|
||||
@override
|
||||
final DateTime? retire;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DiaryModel(id: $id, date: $date, closed: $closed, meals: $meals, state: $state, comment: $comment, wakeup: $wakeup, retire: $retire)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$DiaryModelImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.date, date) || other.date == date) &&
|
||||
(identical(other.closed, closed) || other.closed == closed) &&
|
||||
const DeepCollectionEquality().equals(other._meals, _meals) &&
|
||||
(identical(other.state, state) || other.state == state) &&
|
||||
(identical(other.comment, comment) || other.comment == comment) &&
|
||||
(identical(other.wakeup, wakeup) || other.wakeup == wakeup) &&
|
||||
(identical(other.retire, retire) || other.retire == retire));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
date,
|
||||
closed,
|
||||
const DeepCollectionEquality().hash(_meals),
|
||||
state,
|
||||
comment,
|
||||
wakeup,
|
||||
retire);
|
||||
|
||||
/// Create a copy of DiaryModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith =>
|
||||
__$$DiaryModelImplCopyWithImpl<_$DiaryModelImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$DiaryModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _DiaryModel implements DiaryModel {
|
||||
const factory _DiaryModel(
|
||||
{required final int id,
|
||||
required final DateTime date,
|
||||
required final int closed,
|
||||
required final List<Meal> meals,
|
||||
required final State state,
|
||||
final String? comment,
|
||||
final DateTime? wakeup,
|
||||
final DateTime? retire}) = _$DiaryModelImpl;
|
||||
|
||||
factory _DiaryModel.fromJson(Map<String, dynamic> json) =
|
||||
_$DiaryModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get id;
|
||||
@override
|
||||
DateTime get date;
|
||||
@override
|
||||
int get closed;
|
||||
@override
|
||||
List<Meal> get meals;
|
||||
@override
|
||||
State get state;
|
||||
@override
|
||||
String? get comment;
|
||||
@override
|
||||
DateTime? get wakeup;
|
||||
@override
|
||||
DateTime? get retire;
|
||||
|
||||
/// Create a copy of DiaryModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'diary_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$DiaryModelImpl _$$DiaryModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$DiaryModelImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
date: DateTime.parse(json['date'] as String),
|
||||
closed: (json['closed'] as num).toInt(),
|
||||
meals: (json['meals'] as List<dynamic>)
|
||||
.map((e) => Meal.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
state: State.fromJson(json['state'] as Map<String, dynamic>),
|
||||
comment: json['comment'] as String?,
|
||||
wakeup: json['wakeup'] == null
|
||||
? null
|
||||
: DateTime.parse(json['wakeup'] as String),
|
||||
retire: json['retire'] == null
|
||||
? null
|
||||
: DateTime.parse(json['retire'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$DiaryModelImplToJson(_$DiaryModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'date': instance.date.toIso8601String(),
|
||||
'closed': instance.closed,
|
||||
'meals': instance.meals,
|
||||
'state': instance.state,
|
||||
'comment': instance.comment,
|
||||
'wakeup': instance.wakeup?.toIso8601String(),
|
||||
'retire': instance.retire?.toIso8601String(),
|
||||
};
|
||||
@@ -1,23 +0,0 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import './photo.dart';
|
||||
import './portion.dart';
|
||||
|
||||
part 'meal.freezed.dart';
|
||||
|
||||
part 'meal.g.dart';
|
||||
|
||||
@freezed
|
||||
class Meal with _$Meal {
|
||||
const factory Meal({
|
||||
required int id,
|
||||
required String time,
|
||||
required int type,
|
||||
required int satiety,
|
||||
required int mood,
|
||||
required List<Portion> portions,
|
||||
required List<Photo> photos,
|
||||
}) = _Meal;
|
||||
|
||||
factory Meal.fromJson(Map<String, Object?> json) => _$MealFromJson(json);
|
||||
}
|
||||
@@ -1,304 +0,0 @@
|
||||
// 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 'meal.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');
|
||||
|
||||
Meal _$MealFromJson(Map<String, dynamic> json) {
|
||||
return _Meal.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Meal {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
String get time => throw _privateConstructorUsedError;
|
||||
int get type => throw _privateConstructorUsedError;
|
||||
int get satiety => throw _privateConstructorUsedError;
|
||||
int get mood => throw _privateConstructorUsedError;
|
||||
List<Portion> get portions => throw _privateConstructorUsedError;
|
||||
List<Photo> get photos => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this Meal to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of Meal
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$MealCopyWith<Meal> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $MealCopyWith<$Res> {
|
||||
factory $MealCopyWith(Meal value, $Res Function(Meal) then) =
|
||||
_$MealCopyWithImpl<$Res, Meal>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
String time,
|
||||
int type,
|
||||
int satiety,
|
||||
int mood,
|
||||
List<Portion> portions,
|
||||
List<Photo> photos});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$MealCopyWithImpl<$Res, $Val extends Meal>
|
||||
implements $MealCopyWith<$Res> {
|
||||
_$MealCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of Meal
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? time = null,
|
||||
Object? type = null,
|
||||
Object? satiety = null,
|
||||
Object? mood = null,
|
||||
Object? portions = null,
|
||||
Object? photos = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
time: null == time
|
||||
? _value.time
|
||||
: time // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
type: null == type
|
||||
? _value.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
satiety: null == satiety
|
||||
? _value.satiety
|
||||
: satiety // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
mood: null == mood
|
||||
? _value.mood
|
||||
: mood // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
portions: null == portions
|
||||
? _value.portions
|
||||
: portions // ignore: cast_nullable_to_non_nullable
|
||||
as List<Portion>,
|
||||
photos: null == photos
|
||||
? _value.photos
|
||||
: photos // ignore: cast_nullable_to_non_nullable
|
||||
as List<Photo>,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MealImplCopyWith<$Res> implements $MealCopyWith<$Res> {
|
||||
factory _$$MealImplCopyWith(
|
||||
_$MealImpl value, $Res Function(_$MealImpl) then) =
|
||||
__$$MealImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
String time,
|
||||
int type,
|
||||
int satiety,
|
||||
int mood,
|
||||
List<Portion> portions,
|
||||
List<Photo> photos});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$MealImplCopyWithImpl<$Res>
|
||||
extends _$MealCopyWithImpl<$Res, _$MealImpl>
|
||||
implements _$$MealImplCopyWith<$Res> {
|
||||
__$$MealImplCopyWithImpl(_$MealImpl _value, $Res Function(_$MealImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of Meal
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? time = null,
|
||||
Object? type = null,
|
||||
Object? satiety = null,
|
||||
Object? mood = null,
|
||||
Object? portions = null,
|
||||
Object? photos = null,
|
||||
}) {
|
||||
return _then(_$MealImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
time: null == time
|
||||
? _value.time
|
||||
: time // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
type: null == type
|
||||
? _value.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
satiety: null == satiety
|
||||
? _value.satiety
|
||||
: satiety // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
mood: null == mood
|
||||
? _value.mood
|
||||
: mood // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
portions: null == portions
|
||||
? _value._portions
|
||||
: portions // ignore: cast_nullable_to_non_nullable
|
||||
as List<Portion>,
|
||||
photos: null == photos
|
||||
? _value._photos
|
||||
: photos // ignore: cast_nullable_to_non_nullable
|
||||
as List<Photo>,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$MealImpl implements _Meal {
|
||||
const _$MealImpl(
|
||||
{required this.id,
|
||||
required this.time,
|
||||
required this.type,
|
||||
required this.satiety,
|
||||
required this.mood,
|
||||
required final List<Portion> portions,
|
||||
required final List<Photo> photos})
|
||||
: _portions = portions,
|
||||
_photos = photos;
|
||||
|
||||
factory _$MealImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$MealImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
final String time;
|
||||
@override
|
||||
final int type;
|
||||
@override
|
||||
final int satiety;
|
||||
@override
|
||||
final int mood;
|
||||
final List<Portion> _portions;
|
||||
@override
|
||||
List<Portion> get portions {
|
||||
if (_portions is EqualUnmodifiableListView) return _portions;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_portions);
|
||||
}
|
||||
|
||||
final List<Photo> _photos;
|
||||
@override
|
||||
List<Photo> get photos {
|
||||
if (_photos is EqualUnmodifiableListView) return _photos;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_photos);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Meal(id: $id, time: $time, type: $type, satiety: $satiety, mood: $mood, portions: $portions, photos: $photos)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MealImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.time, time) || other.time == time) &&
|
||||
(identical(other.type, type) || other.type == type) &&
|
||||
(identical(other.satiety, satiety) || other.satiety == satiety) &&
|
||||
(identical(other.mood, mood) || other.mood == mood) &&
|
||||
const DeepCollectionEquality().equals(other._portions, _portions) &&
|
||||
const DeepCollectionEquality().equals(other._photos, _photos));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
time,
|
||||
type,
|
||||
satiety,
|
||||
mood,
|
||||
const DeepCollectionEquality().hash(_portions),
|
||||
const DeepCollectionEquality().hash(_photos));
|
||||
|
||||
/// Create a copy of Meal
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$MealImplCopyWith<_$MealImpl> get copyWith =>
|
||||
__$$MealImplCopyWithImpl<_$MealImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$MealImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Meal implements Meal {
|
||||
const factory _Meal(
|
||||
{required final int id,
|
||||
required final String time,
|
||||
required final int type,
|
||||
required final int satiety,
|
||||
required final int mood,
|
||||
required final List<Portion> portions,
|
||||
required final List<Photo> photos}) = _$MealImpl;
|
||||
|
||||
factory _Meal.fromJson(Map<String, dynamic> json) = _$MealImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get id;
|
||||
@override
|
||||
String get time;
|
||||
@override
|
||||
int get type;
|
||||
@override
|
||||
int get satiety;
|
||||
@override
|
||||
int get mood;
|
||||
@override
|
||||
List<Portion> get portions;
|
||||
@override
|
||||
List<Photo> get photos;
|
||||
|
||||
/// Create a copy of Meal
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$MealImplCopyWith<_$MealImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'meal.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$MealImpl _$$MealImplFromJson(Map<String, dynamic> json) => _$MealImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
time: json['time'] as String,
|
||||
type: (json['type'] as num).toInt(),
|
||||
satiety: (json['satiety'] as num).toInt(),
|
||||
mood: (json['mood'] as num).toInt(),
|
||||
portions: (json['portions'] as List<dynamic>)
|
||||
.map((e) => Portion.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
photos: (json['photos'] as List<dynamic>)
|
||||
.map((e) => Photo.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$MealImplToJson(_$MealImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'time': instance.time,
|
||||
'type': instance.type,
|
||||
'satiety': instance.satiety,
|
||||
'mood': instance.mood,
|
||||
'portions': instance.portions,
|
||||
'photos': instance.photos,
|
||||
};
|
||||
@@ -1,16 +0,0 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'photo.freezed.dart';
|
||||
|
||||
part 'photo.g.dart';
|
||||
|
||||
@freezed
|
||||
class Photo with _$Photo {
|
||||
const factory Photo({
|
||||
required int id,
|
||||
@JsonKey(name: 'original_name') required String originalName,
|
||||
required String path,
|
||||
}) = _Photo;
|
||||
|
||||
factory Photo.fromJson(Map<String, Object?> json) => _$PhotoFromJson(json);
|
||||
}
|
||||
@@ -1,208 +0,0 @@
|
||||
// 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 'photo.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');
|
||||
|
||||
Photo _$PhotoFromJson(Map<String, dynamic> json) {
|
||||
return _Photo.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Photo {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'original_name')
|
||||
String get originalName => throw _privateConstructorUsedError;
|
||||
String get path => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this Photo to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of Photo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$PhotoCopyWith<Photo> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $PhotoCopyWith<$Res> {
|
||||
factory $PhotoCopyWith(Photo value, $Res Function(Photo) then) =
|
||||
_$PhotoCopyWithImpl<$Res, Photo>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
@JsonKey(name: 'original_name') String originalName,
|
||||
String path});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$PhotoCopyWithImpl<$Res, $Val extends Photo>
|
||||
implements $PhotoCopyWith<$Res> {
|
||||
_$PhotoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of Photo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? originalName = null,
|
||||
Object? path = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
originalName: null == originalName
|
||||
? _value.originalName
|
||||
: originalName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
path: null == path
|
||||
? _value.path
|
||||
: path // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$PhotoImplCopyWith<$Res> implements $PhotoCopyWith<$Res> {
|
||||
factory _$$PhotoImplCopyWith(
|
||||
_$PhotoImpl value, $Res Function(_$PhotoImpl) then) =
|
||||
__$$PhotoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
@JsonKey(name: 'original_name') String originalName,
|
||||
String path});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$PhotoImplCopyWithImpl<$Res>
|
||||
extends _$PhotoCopyWithImpl<$Res, _$PhotoImpl>
|
||||
implements _$$PhotoImplCopyWith<$Res> {
|
||||
__$$PhotoImplCopyWithImpl(
|
||||
_$PhotoImpl _value, $Res Function(_$PhotoImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of Photo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? originalName = null,
|
||||
Object? path = null,
|
||||
}) {
|
||||
return _then(_$PhotoImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
originalName: null == originalName
|
||||
? _value.originalName
|
||||
: originalName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
path: null == path
|
||||
? _value.path
|
||||
: path // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$PhotoImpl implements _Photo {
|
||||
const _$PhotoImpl(
|
||||
{required this.id,
|
||||
@JsonKey(name: 'original_name') required this.originalName,
|
||||
required this.path});
|
||||
|
||||
factory _$PhotoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$PhotoImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
@JsonKey(name: 'original_name')
|
||||
final String originalName;
|
||||
@override
|
||||
final String path;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Photo(id: $id, originalName: $originalName, path: $path)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$PhotoImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.originalName, originalName) ||
|
||||
other.originalName == originalName) &&
|
||||
(identical(other.path, path) || other.path == path));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, id, originalName, path);
|
||||
|
||||
/// Create a copy of Photo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$PhotoImplCopyWith<_$PhotoImpl> get copyWith =>
|
||||
__$$PhotoImplCopyWithImpl<_$PhotoImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$PhotoImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Photo implements Photo {
|
||||
const factory _Photo(
|
||||
{required final int id,
|
||||
@JsonKey(name: 'original_name') required final String originalName,
|
||||
required final String path}) = _$PhotoImpl;
|
||||
|
||||
factory _Photo.fromJson(Map<String, dynamic> json) = _$PhotoImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get id;
|
||||
@override
|
||||
@JsonKey(name: 'original_name')
|
||||
String get originalName;
|
||||
@override
|
||||
String get path;
|
||||
|
||||
/// Create a copy of Photo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$PhotoImplCopyWith<_$PhotoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'photo.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$PhotoImpl _$$PhotoImplFromJson(Map<String, dynamic> json) => _$PhotoImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
originalName: json['original_name'] as String,
|
||||
path: json['path'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$PhotoImplToJson(_$PhotoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'original_name': instance.originalName,
|
||||
'path': instance.path,
|
||||
};
|
||||
@@ -1,18 +0,0 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'portion.freezed.dart';
|
||||
|
||||
part 'portion.g.dart';
|
||||
|
||||
@freezed
|
||||
class Portion with _$Portion {
|
||||
const factory Portion({
|
||||
required int id,
|
||||
required String product_name,
|
||||
required int quantity,
|
||||
required String portion,
|
||||
required bool from_diet,
|
||||
}) = _Portion;
|
||||
|
||||
factory Portion.fromJson(Map<String, Object?> json) => _$PortionFromJson(json);
|
||||
}
|
||||
@@ -1,248 +0,0 @@
|
||||
// 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 'portion.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');
|
||||
|
||||
Portion _$PortionFromJson(Map<String, dynamic> json) {
|
||||
return _Portion.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Portion {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
String get product_name => throw _privateConstructorUsedError;
|
||||
int get quantity => throw _privateConstructorUsedError;
|
||||
String get portion => throw _privateConstructorUsedError;
|
||||
bool get from_diet => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this Portion to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of Portion
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$PortionCopyWith<Portion> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $PortionCopyWith<$Res> {
|
||||
factory $PortionCopyWith(Portion value, $Res Function(Portion) then) =
|
||||
_$PortionCopyWithImpl<$Res, Portion>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
String product_name,
|
||||
int quantity,
|
||||
String portion,
|
||||
bool from_diet});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$PortionCopyWithImpl<$Res, $Val extends Portion>
|
||||
implements $PortionCopyWith<$Res> {
|
||||
_$PortionCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of Portion
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? product_name = null,
|
||||
Object? quantity = null,
|
||||
Object? portion = null,
|
||||
Object? from_diet = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
product_name: null == product_name
|
||||
? _value.product_name
|
||||
: product_name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
portion: null == portion
|
||||
? _value.portion
|
||||
: portion // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
from_diet: null == from_diet
|
||||
? _value.from_diet
|
||||
: from_diet // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$PortionImplCopyWith<$Res> implements $PortionCopyWith<$Res> {
|
||||
factory _$$PortionImplCopyWith(
|
||||
_$PortionImpl value, $Res Function(_$PortionImpl) then) =
|
||||
__$$PortionImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
String product_name,
|
||||
int quantity,
|
||||
String portion,
|
||||
bool from_diet});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$PortionImplCopyWithImpl<$Res>
|
||||
extends _$PortionCopyWithImpl<$Res, _$PortionImpl>
|
||||
implements _$$PortionImplCopyWith<$Res> {
|
||||
__$$PortionImplCopyWithImpl(
|
||||
_$PortionImpl _value, $Res Function(_$PortionImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of Portion
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? product_name = null,
|
||||
Object? quantity = null,
|
||||
Object? portion = null,
|
||||
Object? from_diet = null,
|
||||
}) {
|
||||
return _then(_$PortionImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
product_name: null == product_name
|
||||
? _value.product_name
|
||||
: product_name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
portion: null == portion
|
||||
? _value.portion
|
||||
: portion // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
from_diet: null == from_diet
|
||||
? _value.from_diet
|
||||
: from_diet // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$PortionImpl implements _Portion {
|
||||
const _$PortionImpl(
|
||||
{required this.id,
|
||||
required this.product_name,
|
||||
required this.quantity,
|
||||
required this.portion,
|
||||
required this.from_diet});
|
||||
|
||||
factory _$PortionImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$PortionImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
final String product_name;
|
||||
@override
|
||||
final int quantity;
|
||||
@override
|
||||
final String portion;
|
||||
@override
|
||||
final bool from_diet;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Portion(id: $id, product_name: $product_name, quantity: $quantity, portion: $portion, from_diet: $from_diet)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$PortionImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.product_name, product_name) ||
|
||||
other.product_name == product_name) &&
|
||||
(identical(other.quantity, quantity) ||
|
||||
other.quantity == quantity) &&
|
||||
(identical(other.portion, portion) || other.portion == portion) &&
|
||||
(identical(other.from_diet, from_diet) ||
|
||||
other.from_diet == from_diet));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, id, product_name, quantity, portion, from_diet);
|
||||
|
||||
/// Create a copy of Portion
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$PortionImplCopyWith<_$PortionImpl> get copyWith =>
|
||||
__$$PortionImplCopyWithImpl<_$PortionImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$PortionImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Portion implements Portion {
|
||||
const factory _Portion(
|
||||
{required final int id,
|
||||
required final String product_name,
|
||||
required final int quantity,
|
||||
required final String portion,
|
||||
required final bool from_diet}) = _$PortionImpl;
|
||||
|
||||
factory _Portion.fromJson(Map<String, dynamic> json) = _$PortionImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get id;
|
||||
@override
|
||||
String get product_name;
|
||||
@override
|
||||
int get quantity;
|
||||
@override
|
||||
String get portion;
|
||||
@override
|
||||
bool get from_diet;
|
||||
|
||||
/// Create a copy of Portion
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$PortionImplCopyWith<_$PortionImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'portion.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$PortionImpl _$$PortionImplFromJson(Map<String, dynamic> json) =>
|
||||
_$PortionImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
product_name: json['product_name'] as String,
|
||||
quantity: (json['quantity'] as num).toInt(),
|
||||
portion: json['portion'] as String,
|
||||
from_diet: json['from_diet'] as bool,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$PortionImplToJson(_$PortionImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'product_name': instance.product_name,
|
||||
'quantity': instance.quantity,
|
||||
'portion': instance.portion,
|
||||
'from_diet': instance.from_diet,
|
||||
};
|
||||
@@ -1,15 +0,0 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'product.freezed.dart';
|
||||
|
||||
part 'product.g.dart';
|
||||
|
||||
@freezed
|
||||
class Product with _$Product {
|
||||
const factory Product({
|
||||
required int id,
|
||||
required String name,
|
||||
}) = _Product;
|
||||
|
||||
factory Product.fromJson(Map<String, Object?> json) => _$ProductFromJson(json);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'state.freezed.dart';
|
||||
|
||||
part 'state.g.dart';
|
||||
|
||||
@freezed
|
||||
class State with _$State {
|
||||
const factory State({
|
||||
required bool has_chosen_diet,
|
||||
required bool has_chosen_plan,
|
||||
}) = _State;
|
||||
|
||||
factory State.fromJson(Map<String, Object?> json) => _$StateFromJson(json);
|
||||
}
|
||||
@@ -1,182 +0,0 @@
|
||||
// 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 'state.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');
|
||||
|
||||
State _$StateFromJson(Map<String, dynamic> json) {
|
||||
return _State.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$State {
|
||||
bool get has_chosen_diet => throw _privateConstructorUsedError;
|
||||
bool get has_chosen_plan => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this State to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of State
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$StateCopyWith<State> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $StateCopyWith<$Res> {
|
||||
factory $StateCopyWith(State value, $Res Function(State) then) =
|
||||
_$StateCopyWithImpl<$Res, State>;
|
||||
@useResult
|
||||
$Res call({bool has_chosen_diet, bool has_chosen_plan});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$StateCopyWithImpl<$Res, $Val extends State>
|
||||
implements $StateCopyWith<$Res> {
|
||||
_$StateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of State
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? has_chosen_diet = null,
|
||||
Object? has_chosen_plan = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
has_chosen_diet: null == has_chosen_diet
|
||||
? _value.has_chosen_diet
|
||||
: has_chosen_diet // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
has_chosen_plan: null == has_chosen_plan
|
||||
? _value.has_chosen_plan
|
||||
: has_chosen_plan // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$StateImplCopyWith<$Res> implements $StateCopyWith<$Res> {
|
||||
factory _$$StateImplCopyWith(
|
||||
_$StateImpl value, $Res Function(_$StateImpl) then) =
|
||||
__$$StateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({bool has_chosen_diet, bool has_chosen_plan});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$StateImplCopyWithImpl<$Res>
|
||||
extends _$StateCopyWithImpl<$Res, _$StateImpl>
|
||||
implements _$$StateImplCopyWith<$Res> {
|
||||
__$$StateImplCopyWithImpl(
|
||||
_$StateImpl _value, $Res Function(_$StateImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of State
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? has_chosen_diet = null,
|
||||
Object? has_chosen_plan = null,
|
||||
}) {
|
||||
return _then(_$StateImpl(
|
||||
has_chosen_diet: null == has_chosen_diet
|
||||
? _value.has_chosen_diet
|
||||
: has_chosen_diet // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
has_chosen_plan: null == has_chosen_plan
|
||||
? _value.has_chosen_plan
|
||||
: has_chosen_plan // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$StateImpl implements _State {
|
||||
const _$StateImpl(
|
||||
{required this.has_chosen_diet, required this.has_chosen_plan});
|
||||
|
||||
factory _$StateImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$StateImplFromJson(json);
|
||||
|
||||
@override
|
||||
final bool has_chosen_diet;
|
||||
@override
|
||||
final bool has_chosen_plan;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'State(has_chosen_diet: $has_chosen_diet, has_chosen_plan: $has_chosen_plan)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$StateImpl &&
|
||||
(identical(other.has_chosen_diet, has_chosen_diet) ||
|
||||
other.has_chosen_diet == has_chosen_diet) &&
|
||||
(identical(other.has_chosen_plan, has_chosen_plan) ||
|
||||
other.has_chosen_plan == has_chosen_plan));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, has_chosen_diet, has_chosen_plan);
|
||||
|
||||
/// Create a copy of State
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$StateImplCopyWith<_$StateImpl> get copyWith =>
|
||||
__$$StateImplCopyWithImpl<_$StateImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$StateImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _State implements State {
|
||||
const factory _State(
|
||||
{required final bool has_chosen_diet,
|
||||
required final bool has_chosen_plan}) = _$StateImpl;
|
||||
|
||||
factory _State.fromJson(Map<String, dynamic> json) = _$StateImpl.fromJson;
|
||||
|
||||
@override
|
||||
bool get has_chosen_diet;
|
||||
@override
|
||||
bool get has_chosen_plan;
|
||||
|
||||
/// Create a copy of State
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$StateImplCopyWith<_$StateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$StateImpl _$$StateImplFromJson(Map<String, dynamic> json) => _$StateImpl(
|
||||
has_chosen_diet: json['has_chosen_diet'] as bool,
|
||||
has_chosen_plan: json['has_chosen_plan'] as bool,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$StateImplToJson(_$StateImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'has_chosen_diet': instance.has_chosen_diet,
|
||||
'has_chosen_plan': instance.has_chosen_plan,
|
||||
};
|
||||
Reference in New Issue
Block a user