refactor(diary): API connect attempt

This commit is contained in:
2024-07-12 13:16:01 +03:00
parent e4cde31d76
commit 551debd450
21 changed files with 999 additions and 299 deletions

View File

@@ -22,11 +22,11 @@ DiaryModel _$DiaryModelFromJson(Map<String, dynamic> json) {
mixin _$DiaryModel {
int get id => throw _privateConstructorUsedError;
DateTime get date => throw _privateConstructorUsedError;
DateTime get wakeup => throw _privateConstructorUsedError;
DateTime get retire => throw _privateConstructorUsedError;
int get closed => throw _privateConstructorUsedError;
String get comment => throw _privateConstructorUsedError;
List<Meal> get meals => throw _privateConstructorUsedError;
List<Meal>? get meals => throw _privateConstructorUsedError;
String? get comment => throw _privateConstructorUsedError;
DateTime? get wakeup => throw _privateConstructorUsedError;
DateTime? get retire => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
@@ -43,11 +43,11 @@ abstract class $DiaryModelCopyWith<$Res> {
$Res call(
{int id,
DateTime date,
DateTime wakeup,
DateTime retire,
int closed,
String comment,
List<Meal> meals});
List<Meal>? meals,
String? comment,
DateTime? wakeup,
DateTime? retire});
}
/// @nodoc
@@ -65,11 +65,11 @@ class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel>
$Res call({
Object? id = null,
Object? date = null,
Object? wakeup = null,
Object? retire = null,
Object? closed = null,
Object? comment = null,
Object? meals = null,
Object? meals = freezed,
Object? comment = freezed,
Object? wakeup = freezed,
Object? retire = freezed,
}) {
return _then(_value.copyWith(
id: null == id
@@ -80,26 +80,26 @@ class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel>
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as DateTime,
wakeup: null == wakeup
? _value.wakeup
: wakeup // ignore: cast_nullable_to_non_nullable
as DateTime,
retire: null == retire
? _value.retire
: retire // ignore: cast_nullable_to_non_nullable
as DateTime,
closed: null == closed
? _value.closed
: closed // ignore: cast_nullable_to_non_nullable
as int,
comment: null == comment
? _value.comment
: comment // ignore: cast_nullable_to_non_nullable
as String,
meals: null == meals
meals: freezed == meals
? _value.meals
: meals // ignore: cast_nullable_to_non_nullable
as List<Meal>,
as List<Meal>?,
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);
}
}
@@ -115,11 +115,11 @@ abstract class _$$DiaryModelImplCopyWith<$Res>
$Res call(
{int id,
DateTime date,
DateTime wakeup,
DateTime retire,
int closed,
String comment,
List<Meal> meals});
List<Meal>? meals,
String? comment,
DateTime? wakeup,
DateTime? retire});
}
/// @nodoc
@@ -135,11 +135,11 @@ class __$$DiaryModelImplCopyWithImpl<$Res>
$Res call({
Object? id = null,
Object? date = null,
Object? wakeup = null,
Object? retire = null,
Object? closed = null,
Object? comment = null,
Object? meals = null,
Object? meals = freezed,
Object? comment = freezed,
Object? wakeup = freezed,
Object? retire = freezed,
}) {
return _then(_$DiaryModelImpl(
id: null == id
@@ -150,26 +150,26 @@ class __$$DiaryModelImplCopyWithImpl<$Res>
? _value.date
: date // ignore: cast_nullable_to_non_nullable
as DateTime,
wakeup: null == wakeup
? _value.wakeup
: wakeup // ignore: cast_nullable_to_non_nullable
as DateTime,
retire: null == retire
? _value.retire
: retire // ignore: cast_nullable_to_non_nullable
as DateTime,
closed: null == closed
? _value.closed
: closed // ignore: cast_nullable_to_non_nullable
as int,
comment: null == comment
? _value.comment
: comment // ignore: cast_nullable_to_non_nullable
as String,
meals: null == meals
meals: freezed == meals
? _value._meals
: meals // ignore: cast_nullable_to_non_nullable
as List<Meal>,
as List<Meal>?,
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?,
));
}
}
@@ -180,11 +180,11 @@ class _$DiaryModelImpl implements _DiaryModel {
const _$DiaryModelImpl(
{required this.id,
required this.date,
required this.wakeup,
required this.retire,
required this.closed,
required this.comment,
required final List<Meal> meals})
required final List<Meal>? meals,
this.comment,
this.wakeup,
this.retire})
: _meals = meals;
factory _$DiaryModelImpl.fromJson(Map<String, dynamic> json) =>
@@ -195,24 +195,27 @@ class _$DiaryModelImpl implements _DiaryModel {
@override
final DateTime date;
@override
final DateTime wakeup;
@override
final DateTime retire;
@override
final int closed;
final List<Meal>? _meals;
@override
final String comment;
final List<Meal> _meals;
@override
List<Meal> get meals {
List<Meal>? get meals {
final value = _meals;
if (value == null) return null;
if (_meals is EqualUnmodifiableListView) return _meals;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_meals);
return EqualUnmodifiableListView(value);
}
@override
final String? comment;
@override
final DateTime? wakeup;
@override
final DateTime? retire;
@override
String toString() {
return 'DiaryModel(id: $id, date: $date, wakeup: $wakeup, retire: $retire, closed: $closed, comment: $comment, meals: $meals)';
return 'DiaryModel(id: $id, date: $date, closed: $closed, meals: $meals, comment: $comment, wakeup: $wakeup, retire: $retire)';
}
@override
@@ -222,17 +225,17 @@ class _$DiaryModelImpl implements _DiaryModel {
other is _$DiaryModelImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.date, date) || other.date == date) &&
(identical(other.wakeup, wakeup) || other.wakeup == wakeup) &&
(identical(other.retire, retire) || other.retire == retire) &&
(identical(other.closed, closed) || other.closed == closed) &&
const DeepCollectionEquality().equals(other._meals, _meals) &&
(identical(other.comment, comment) || other.comment == comment) &&
const DeepCollectionEquality().equals(other._meals, _meals));
(identical(other.wakeup, wakeup) || other.wakeup == wakeup) &&
(identical(other.retire, retire) || other.retire == retire));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, id, date, wakeup, retire, closed,
comment, const DeepCollectionEquality().hash(_meals));
int get hashCode => Object.hash(runtimeType, id, date, closed,
const DeepCollectionEquality().hash(_meals), comment, wakeup, retire);
@JsonKey(ignore: true)
@override
@@ -252,11 +255,11 @@ abstract class _DiaryModel implements DiaryModel {
const factory _DiaryModel(
{required final int id,
required final DateTime date,
required final DateTime wakeup,
required final DateTime retire,
required final int closed,
required final String comment,
required final List<Meal> meals}) = _$DiaryModelImpl;
required final List<Meal>? meals,
final String? comment,
final DateTime? wakeup,
final DateTime? retire}) = _$DiaryModelImpl;
factory _DiaryModel.fromJson(Map<String, dynamic> json) =
_$DiaryModelImpl.fromJson;
@@ -266,15 +269,15 @@ abstract class _DiaryModel implements DiaryModel {
@override
DateTime get date;
@override
DateTime get wakeup;
@override
DateTime get retire;
@override
int get closed;
@override
String get comment;
List<Meal>? get meals;
@override
List<Meal> get meals;
String? get comment;
@override
DateTime? get wakeup;
@override
DateTime? get retire;
@override
@JsonKey(ignore: true)
_$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith =>