From 8b7f2edd9f21ba395da43349eed26503763c3463 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Fri, 16 Aug 2024 14:04:58 +0300 Subject: [PATCH] feat(feed): --- .../initialization_state.freezed.dart | 96 ++-- .../selection_popup_model.freezed.dart | 53 +- .../new_messages_state.freezed.dart | 92 +-- .../notifications_state.freezed.dart | 95 ++-- .../calendar/services/calendar_service.g.dart | 41 +- .../models/chat_message_model.freezed.dart | 73 +-- .../chat/models/chat_message_model.g.dart | 8 +- .../chat/models/chat_meta_model.freezed.dart | 54 +- .../chat/models/chat_meta_model.g.dart | 6 +- .../chat/models/chat_room_model.freezed.dart | 78 ++- .../chat/models/chat_room_model.g.dart | 12 +- .../chat_room_settings_model.freezed.dart | 78 +-- .../models/chat_room_settings_model.g.dart | 8 +- .../chat/models/chat_user_model.freezed.dart | 78 ++- .../chat/models/chat_user_model.g.dart | 6 +- .../models/websocket_info_model.freezed.dart | 81 +-- .../chat/models/websocket_info_model.g.dart | 8 +- .../bloc/chat_room_cubit/chat_room_cubit.dart | 10 +- .../chat_room_state.freezed.dart | 171 ++++-- .../chat/presentation/pages/chat_screen.dart | 46 +- .../widgets/chat_bubble_widget.dart | 2 + .../chat/repositories/chat_repository.dart | 4 +- lib/features/chat/services/chat_service.dart | 3 +- .../chat/services/chat_service.g.dart | 121 ++-- lib/features/diary/models/photo.freezed.dart | 59 +- lib/features/diary/models/photo.g.dart | 3 +- .../diary/services/diary_service.g.dart | 346 +++++++----- .../diets_pagination_model.freezed.dart | 530 ++++++++++-------- .../feed/models/diets_pagination_model.g.dart | 46 +- .../models/feed_blog_post_settings_model.dart | 2 + ...feed_blog_post_settings_model.freezed.dart | 55 +- .../feed_blog_post_settings_model.g.dart | 2 + .../bloc/diets_cubit/diets_state.freezed.dart | 90 ++- .../bloc/feed_cubit/feed_cubit.dart | 36 +- .../bloc/feed_cubit/feed_state.dart | 1 + .../bloc/feed_cubit/feed_state.freezed.dart | 84 ++- .../feed/presentation/pages/feed_screen.dart | 6 + .../widgets/blog_post_widget.dart | 43 +- .../feed/repositories/feed_repository.dart | 6 +- lib/features/feed/services/feed_service.dart | 6 +- .../feed/services/feed_service.g.dart | 107 ++-- .../profile/services/profile_service.g.dart | 37 +- lib/features/recipes/models/image.g.dart | 3 +- .../bloc/recipe_create_cubit.dart | 29 +- .../recipes/services/recipe_service.g.dart | 39 +- .../services/registration_service.g.dart | 105 ++-- lib/main.dart | 2 - pubspec.yaml | 4 +- 48 files changed, 1767 insertions(+), 1098 deletions(-) diff --git a/lib/core/initialization_cubit/initialization_state.freezed.dart b/lib/core/initialization_cubit/initialization_state.freezed.dart index 5d54500a..3364e440 100644 --- a/lib/core/initialization_cubit/initialization_state.freezed.dart +++ b/lib/core/initialization_cubit/initialization_state.freezed.dart @@ -24,7 +24,6 @@ mixin _$InitializationState { required TResult Function(String errorMessage) error, }) => throw _privateConstructorUsedError; - @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { @@ -71,31 +70,36 @@ mixin _$InitializationState { /// @nodoc abstract class $InitializationStateCopyWith<$Res> { - factory $InitializationStateCopyWith(InitializationState value, $Res Function(InitializationState) then) = + factory $InitializationStateCopyWith( + InitializationState value, $Res Function(InitializationState) then) = _$InitializationStateCopyWithImpl<$Res, InitializationState>; } /// @nodoc -class _$InitializationStateCopyWithImpl<$Res, $Val extends InitializationState> implements $InitializationStateCopyWith<$Res> { +class _$InitializationStateCopyWithImpl<$Res, $Val extends InitializationState> + implements $InitializationStateCopyWith<$Res> { _$InitializationStateCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; } /// @nodoc abstract class _$$InitializationStateImplCopyWith<$Res> { - factory _$$InitializationStateImplCopyWith(_$InitializationStateImpl value, $Res Function(_$InitializationStateImpl) then) = + factory _$$InitializationStateImplCopyWith(_$InitializationStateImpl value, + $Res Function(_$InitializationStateImpl) then) = __$$InitializationStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$InitializationStateImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateImpl> +class __$$InitializationStateImplCopyWithImpl<$Res> + extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateImpl> implements _$$InitializationStateImplCopyWith<$Res> { - __$$InitializationStateImplCopyWithImpl(_$InitializationStateImpl _value, $Res Function(_$InitializationStateImpl) _then) : super(_value, _then); + __$$InitializationStateImplCopyWithImpl(_$InitializationStateImpl _value, + $Res Function(_$InitializationStateImpl) _then) + : super(_value, _then); } /// @nodoc @@ -110,7 +114,9 @@ class _$InitializationStateImpl implements _InitializationState { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$InitializationStateImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InitializationStateImpl); } @override @@ -197,14 +203,20 @@ abstract class _InitializationState implements InitializationState { /// @nodoc abstract class _$$InitializationStateLoadingImplCopyWith<$Res> { - factory _$$InitializationStateLoadingImplCopyWith(_$InitializationStateLoadingImpl value, $Res Function(_$InitializationStateLoadingImpl) then) = + factory _$$InitializationStateLoadingImplCopyWith( + _$InitializationStateLoadingImpl value, + $Res Function(_$InitializationStateLoadingImpl) then) = __$$InitializationStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc -class __$$InitializationStateLoadingImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateLoadingImpl> +class __$$InitializationStateLoadingImplCopyWithImpl<$Res> + extends _$InitializationStateCopyWithImpl<$Res, + _$InitializationStateLoadingImpl> implements _$$InitializationStateLoadingImplCopyWith<$Res> { - __$$InitializationStateLoadingImplCopyWithImpl(_$InitializationStateLoadingImpl _value, $Res Function(_$InitializationStateLoadingImpl) _then) + __$$InitializationStateLoadingImplCopyWithImpl( + _$InitializationStateLoadingImpl _value, + $Res Function(_$InitializationStateLoadingImpl) _then) : super(_value, _then); } @@ -220,7 +232,9 @@ class _$InitializationStateLoadingImpl implements InitializationStateLoading { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$InitializationStateLoadingImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InitializationStateLoadingImpl); } @override @@ -307,17 +321,22 @@ abstract class InitializationStateLoading implements InitializationState { /// @nodoc abstract class _$$InitializationStateSuccessImplCopyWith<$Res> { - factory _$$InitializationStateSuccessImplCopyWith(_$InitializationStateSuccessImpl value, $Res Function(_$InitializationStateSuccessImpl) then) = + factory _$$InitializationStateSuccessImplCopyWith( + _$InitializationStateSuccessImpl value, + $Res Function(_$InitializationStateSuccessImpl) then) = __$$InitializationStateSuccessImplCopyWithImpl<$Res>; - @useResult $Res call({PusherChannelsClient client}); } /// @nodoc -class __$$InitializationStateSuccessImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateSuccessImpl> +class __$$InitializationStateSuccessImplCopyWithImpl<$Res> + extends _$InitializationStateCopyWithImpl<$Res, + _$InitializationStateSuccessImpl> implements _$$InitializationStateSuccessImplCopyWith<$Res> { - __$$InitializationStateSuccessImplCopyWithImpl(_$InitializationStateSuccessImpl _value, $Res Function(_$InitializationStateSuccessImpl) _then) + __$$InitializationStateSuccessImplCopyWithImpl( + _$InitializationStateSuccessImpl _value, + $Res Function(_$InitializationStateSuccessImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -350,7 +369,9 @@ class _$InitializationStateSuccessImpl implements InitializationStateSuccess { @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$InitializationStateSuccessImpl && (identical(other.client, client) || other.client == client)); + (other.runtimeType == runtimeType && + other is _$InitializationStateSuccessImpl && + (identical(other.client, client) || other.client == client)); } @override @@ -359,8 +380,9 @@ class _$InitializationStateSuccessImpl implements InitializationStateSuccess { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> get copyWith => - __$$InitializationStateSuccessImplCopyWithImpl<_$InitializationStateSuccessImpl>(this, _$identity); + _$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> + get copyWith => __$$InitializationStateSuccessImplCopyWithImpl< + _$InitializationStateSuccessImpl>(this, _$identity); @override @optionalTypeArgs @@ -438,27 +460,34 @@ class _$InitializationStateSuccessImpl implements InitializationStateSuccess { } abstract class InitializationStateSuccess implements InitializationState { - const factory InitializationStateSuccess({required final PusherChannelsClient client}) = _$InitializationStateSuccessImpl; + const factory InitializationStateSuccess( + {required final PusherChannelsClient client}) = + _$InitializationStateSuccessImpl; PusherChannelsClient get client; - @JsonKey(ignore: true) - _$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> get copyWith => throw _privateConstructorUsedError; + _$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$InitializationStateErrorImplCopyWith<$Res> { - factory _$$InitializationStateErrorImplCopyWith(_$InitializationStateErrorImpl value, $Res Function(_$InitializationStateErrorImpl) then) = + factory _$$InitializationStateErrorImplCopyWith( + _$InitializationStateErrorImpl value, + $Res Function(_$InitializationStateErrorImpl) then) = __$$InitializationStateErrorImplCopyWithImpl<$Res>; - @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$InitializationStateErrorImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateErrorImpl> +class __$$InitializationStateErrorImplCopyWithImpl<$Res> + extends _$InitializationStateCopyWithImpl<$Res, + _$InitializationStateErrorImpl> implements _$$InitializationStateErrorImplCopyWith<$Res> { - __$$InitializationStateErrorImplCopyWithImpl(_$InitializationStateErrorImpl _value, $Res Function(_$InitializationStateErrorImpl) _then) + __$$InitializationStateErrorImplCopyWithImpl( + _$InitializationStateErrorImpl _value, + $Res Function(_$InitializationStateErrorImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -493,7 +522,8 @@ class _$InitializationStateErrorImpl implements InitializationStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$InitializationStateErrorImpl && - (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || + other.errorMessage == errorMessage)); } @override @@ -502,8 +532,9 @@ class _$InitializationStateErrorImpl implements InitializationStateError { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> get copyWith => - __$$InitializationStateErrorImplCopyWithImpl<_$InitializationStateErrorImpl>(this, _$identity); + _$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> + get copyWith => __$$InitializationStateErrorImplCopyWithImpl< + _$InitializationStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -581,10 +612,11 @@ class _$InitializationStateErrorImpl implements InitializationStateError { } abstract class InitializationStateError implements InitializationState { - const factory InitializationStateError({required final String errorMessage}) = _$InitializationStateErrorImpl; + const factory InitializationStateError({required final String errorMessage}) = + _$InitializationStateErrorImpl; String get errorMessage; - @JsonKey(ignore: true) - _$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> get copyWith => throw _privateConstructorUsedError; + _$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart b/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart index 79d30b48..917785c7 100644 --- a/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart +++ b/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart @@ -17,33 +17,31 @@ final _privateConstructorUsedError = UnsupportedError( /// @nodoc mixin _$SelectionPopupModel { int? get id => throw _privateConstructorUsedError; - String get title => throw _privateConstructorUsedError; - dynamic get value => throw _privateConstructorUsedError; - bool get isSelected => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $SelectionPopupModelCopyWith get copyWith => throw _privateConstructorUsedError; + $SelectionPopupModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $SelectionPopupModelCopyWith<$Res> { - factory $SelectionPopupModelCopyWith(SelectionPopupModel value, $Res Function(SelectionPopupModel) then) = + factory $SelectionPopupModelCopyWith( + SelectionPopupModel value, $Res Function(SelectionPopupModel) then) = _$SelectionPopupModelCopyWithImpl<$Res, SelectionPopupModel>; - @useResult $Res call({int? id, String title, dynamic value, bool isSelected}); } /// @nodoc -class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel> implements $SelectionPopupModelCopyWith<$Res> { +class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel> + implements $SelectionPopupModelCopyWith<$Res> { _$SelectionPopupModelCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -77,19 +75,23 @@ class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel> } /// @nodoc -abstract class _$$SelectionPopupModelImplCopyWith<$Res> implements $SelectionPopupModelCopyWith<$Res> { - factory _$$SelectionPopupModelImplCopyWith(_$SelectionPopupModelImpl value, $Res Function(_$SelectionPopupModelImpl) then) = +abstract class _$$SelectionPopupModelImplCopyWith<$Res> + implements $SelectionPopupModelCopyWith<$Res> { + factory _$$SelectionPopupModelImplCopyWith(_$SelectionPopupModelImpl value, + $Res Function(_$SelectionPopupModelImpl) then) = __$$SelectionPopupModelImplCopyWithImpl<$Res>; - @override @useResult $Res call({int? id, String title, dynamic value, bool isSelected}); } /// @nodoc -class __$$SelectionPopupModelImplCopyWithImpl<$Res> extends _$SelectionPopupModelCopyWithImpl<$Res, _$SelectionPopupModelImpl> +class __$$SelectionPopupModelImplCopyWithImpl<$Res> + extends _$SelectionPopupModelCopyWithImpl<$Res, _$SelectionPopupModelImpl> implements _$$SelectionPopupModelImplCopyWith<$Res> { - __$$SelectionPopupModelImplCopyWithImpl(_$SelectionPopupModelImpl _value, $Res Function(_$SelectionPopupModelImpl) _then) : super(_value, _then); + __$$SelectionPopupModelImplCopyWithImpl(_$SelectionPopupModelImpl _value, + $Res Function(_$SelectionPopupModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -123,7 +125,8 @@ class __$$SelectionPopupModelImplCopyWithImpl<$Res> extends _$SelectionPopupMode /// @nodoc class _$SelectionPopupModelImpl implements _SelectionPopupModel { - const _$SelectionPopupModelImpl({this.id, required this.title, this.value, this.isSelected = false}); + const _$SelectionPopupModelImpl( + {this.id, required this.title, this.value, this.isSelected = false}); @override final int? id; @@ -148,35 +151,39 @@ class _$SelectionPopupModelImpl implements _SelectionPopupModel { (identical(other.id, id) || other.id == id) && (identical(other.title, title) || other.title == title) && const DeepCollectionEquality().equals(other.value, value) && - (identical(other.isSelected, isSelected) || other.isSelected == isSelected)); + (identical(other.isSelected, isSelected) || + other.isSelected == isSelected)); } @override - int get hashCode => Object.hash(runtimeType, id, title, const DeepCollectionEquality().hash(value), isSelected); + int get hashCode => Object.hash(runtimeType, id, title, + const DeepCollectionEquality().hash(value), isSelected); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') _$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith => - __$$SelectionPopupModelImplCopyWithImpl<_$SelectionPopupModelImpl>(this, _$identity); + __$$SelectionPopupModelImplCopyWithImpl<_$SelectionPopupModelImpl>( + this, _$identity); } abstract class _SelectionPopupModel implements SelectionPopupModel { - const factory _SelectionPopupModel({final int? id, required final String title, final dynamic value, final bool isSelected}) = _$SelectionPopupModelImpl; + const factory _SelectionPopupModel( + {final int? id, + required final String title, + final dynamic value, + final bool isSelected}) = _$SelectionPopupModelImpl; @override int? get id; - @override String get title; - @override dynamic get value; - @override bool get isSelected; - @override @JsonKey(ignore: true) - _$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart b/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart index e150ef99..02a1c4bd 100644 --- a/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart +++ b/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart @@ -24,7 +24,6 @@ mixin _$NewMessagesState { required TResult Function(String errorMessage) error, }) => throw _privateConstructorUsedError; - @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { @@ -71,30 +70,36 @@ mixin _$NewMessagesState { /// @nodoc abstract class $NewMessagesStateCopyWith<$Res> { - factory $NewMessagesStateCopyWith(NewMessagesState value, $Res Function(NewMessagesState) then) = _$NewMessagesStateCopyWithImpl<$Res, NewMessagesState>; + factory $NewMessagesStateCopyWith( + NewMessagesState value, $Res Function(NewMessagesState) then) = + _$NewMessagesStateCopyWithImpl<$Res, NewMessagesState>; } /// @nodoc -class _$NewMessagesStateCopyWithImpl<$Res, $Val extends NewMessagesState> implements $NewMessagesStateCopyWith<$Res> { +class _$NewMessagesStateCopyWithImpl<$Res, $Val extends NewMessagesState> + implements $NewMessagesStateCopyWith<$Res> { _$NewMessagesStateCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; } /// @nodoc abstract class _$$NewMessagesStateImplCopyWith<$Res> { - factory _$$NewMessagesStateImplCopyWith(_$NewMessagesStateImpl value, $Res Function(_$NewMessagesStateImpl) then) = + factory _$$NewMessagesStateImplCopyWith(_$NewMessagesStateImpl value, + $Res Function(_$NewMessagesStateImpl) then) = __$$NewMessagesStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$NewMessagesStateImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateImpl> +class __$$NewMessagesStateImplCopyWithImpl<$Res> + extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateImpl> implements _$$NewMessagesStateImplCopyWith<$Res> { - __$$NewMessagesStateImplCopyWithImpl(_$NewMessagesStateImpl _value, $Res Function(_$NewMessagesStateImpl) _then) : super(_value, _then); + __$$NewMessagesStateImplCopyWithImpl(_$NewMessagesStateImpl _value, + $Res Function(_$NewMessagesStateImpl) _then) + : super(_value, _then); } /// @nodoc @@ -109,7 +114,8 @@ class _$NewMessagesStateImpl implements _NewMessagesState { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$NewMessagesStateImpl); } @override @@ -196,14 +202,19 @@ abstract class _NewMessagesState implements NewMessagesState { /// @nodoc abstract class _$$NewMessagesStateEmptyImplCopyWith<$Res> { - factory _$$NewMessagesStateEmptyImplCopyWith(_$NewMessagesStateEmptyImpl value, $Res Function(_$NewMessagesStateEmptyImpl) then) = + factory _$$NewMessagesStateEmptyImplCopyWith( + _$NewMessagesStateEmptyImpl value, + $Res Function(_$NewMessagesStateEmptyImpl) then) = __$$NewMessagesStateEmptyImplCopyWithImpl<$Res>; } /// @nodoc -class __$$NewMessagesStateEmptyImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateEmptyImpl> +class __$$NewMessagesStateEmptyImplCopyWithImpl<$Res> + extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateEmptyImpl> implements _$$NewMessagesStateEmptyImplCopyWith<$Res> { - __$$NewMessagesStateEmptyImplCopyWithImpl(_$NewMessagesStateEmptyImpl _value, $Res Function(_$NewMessagesStateEmptyImpl) _then) : super(_value, _then); + __$$NewMessagesStateEmptyImplCopyWithImpl(_$NewMessagesStateEmptyImpl _value, + $Res Function(_$NewMessagesStateEmptyImpl) _then) + : super(_value, _then); } /// @nodoc @@ -218,7 +229,9 @@ class _$NewMessagesStateEmptyImpl implements NewMessagesStateEmpty { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateEmptyImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$NewMessagesStateEmptyImpl); } @override @@ -305,17 +318,22 @@ abstract class NewMessagesStateEmpty implements NewMessagesState { /// @nodoc abstract class _$$NewMessagesStateLoadedImplCopyWith<$Res> { - factory _$$NewMessagesStateLoadedImplCopyWith(_$NewMessagesStateLoadedImpl value, $Res Function(_$NewMessagesStateLoadedImpl) then) = + factory _$$NewMessagesStateLoadedImplCopyWith( + _$NewMessagesStateLoadedImpl value, + $Res Function(_$NewMessagesStateLoadedImpl) then) = __$$NewMessagesStateLoadedImplCopyWithImpl<$Res>; - @useResult $Res call({int messagesCount}); } /// @nodoc -class __$$NewMessagesStateLoadedImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateLoadedImpl> +class __$$NewMessagesStateLoadedImplCopyWithImpl<$Res> + extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateLoadedImpl> implements _$$NewMessagesStateLoadedImplCopyWith<$Res> { - __$$NewMessagesStateLoadedImplCopyWithImpl(_$NewMessagesStateLoadedImpl _value, $Res Function(_$NewMessagesStateLoadedImpl) _then) : super(_value, _then); + __$$NewMessagesStateLoadedImplCopyWithImpl( + _$NewMessagesStateLoadedImpl _value, + $Res Function(_$NewMessagesStateLoadedImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -349,7 +367,8 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateLoadedImpl && - (identical(other.messagesCount, messagesCount) || other.messagesCount == messagesCount)); + (identical(other.messagesCount, messagesCount) || + other.messagesCount == messagesCount)); } @override @@ -358,8 +377,9 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> get copyWith => - __$$NewMessagesStateLoadedImplCopyWithImpl<_$NewMessagesStateLoadedImpl>(this, _$identity); + _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> + get copyWith => __$$NewMessagesStateLoadedImplCopyWithImpl< + _$NewMessagesStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs @@ -437,27 +457,32 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded { } abstract class NewMessagesStateLoaded implements NewMessagesState { - const factory NewMessagesStateLoaded({required final int messagesCount}) = _$NewMessagesStateLoadedImpl; + const factory NewMessagesStateLoaded({required final int messagesCount}) = + _$NewMessagesStateLoadedImpl; int get messagesCount; - @JsonKey(ignore: true) - _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; + _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$NewMessagesStateErrorImplCopyWith<$Res> { - factory _$$NewMessagesStateErrorImplCopyWith(_$NewMessagesStateErrorImpl value, $Res Function(_$NewMessagesStateErrorImpl) then) = + factory _$$NewMessagesStateErrorImplCopyWith( + _$NewMessagesStateErrorImpl value, + $Res Function(_$NewMessagesStateErrorImpl) then) = __$$NewMessagesStateErrorImplCopyWithImpl<$Res>; - @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$NewMessagesStateErrorImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateErrorImpl> +class __$$NewMessagesStateErrorImplCopyWithImpl<$Res> + extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateErrorImpl> implements _$$NewMessagesStateErrorImplCopyWith<$Res> { - __$$NewMessagesStateErrorImplCopyWithImpl(_$NewMessagesStateErrorImpl _value, $Res Function(_$NewMessagesStateErrorImpl) _then) : super(_value, _then); + __$$NewMessagesStateErrorImplCopyWithImpl(_$NewMessagesStateErrorImpl _value, + $Res Function(_$NewMessagesStateErrorImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -491,7 +516,8 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateErrorImpl && - (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || + other.errorMessage == errorMessage)); } @override @@ -500,8 +526,9 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> get copyWith => - __$$NewMessagesStateErrorImplCopyWithImpl<_$NewMessagesStateErrorImpl>(this, _$identity); + _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> + get copyWith => __$$NewMessagesStateErrorImplCopyWithImpl< + _$NewMessagesStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -579,10 +606,11 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError { } abstract class NewMessagesStateError implements NewMessagesState { - const factory NewMessagesStateError({required final String errorMessage}) = _$NewMessagesStateErrorImpl; + const factory NewMessagesStateError({required final String errorMessage}) = + _$NewMessagesStateErrorImpl; String get errorMessage; - @JsonKey(ignore: true) - _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> get copyWith => throw _privateConstructorUsedError; + _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart b/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart index b4b95e0c..0deeebbd 100644 --- a/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart +++ b/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart @@ -24,7 +24,6 @@ mixin _$NotificationsState { required TResult Function(String errorMessage) error, }) => throw _privateConstructorUsedError; - @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { @@ -71,31 +70,36 @@ mixin _$NotificationsState { /// @nodoc abstract class $NotificationsStateCopyWith<$Res> { - factory $NotificationsStateCopyWith(NotificationsState value, $Res Function(NotificationsState) then) = + factory $NotificationsStateCopyWith( + NotificationsState value, $Res Function(NotificationsState) then) = _$NotificationsStateCopyWithImpl<$Res, NotificationsState>; } /// @nodoc -class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState> implements $NotificationsStateCopyWith<$Res> { +class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState> + implements $NotificationsStateCopyWith<$Res> { _$NotificationsStateCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; } /// @nodoc abstract class _$$NotificationsStateImplCopyWith<$Res> { - factory _$$NotificationsStateImplCopyWith(_$NotificationsStateImpl value, $Res Function(_$NotificationsStateImpl) then) = + factory _$$NotificationsStateImplCopyWith(_$NotificationsStateImpl value, + $Res Function(_$NotificationsStateImpl) then) = __$$NotificationsStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$NotificationsStateImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateImpl> +class __$$NotificationsStateImplCopyWithImpl<$Res> + extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateImpl> implements _$$NotificationsStateImplCopyWith<$Res> { - __$$NotificationsStateImplCopyWithImpl(_$NotificationsStateImpl _value, $Res Function(_$NotificationsStateImpl) _then) : super(_value, _then); + __$$NotificationsStateImplCopyWithImpl(_$NotificationsStateImpl _value, + $Res Function(_$NotificationsStateImpl) _then) + : super(_value, _then); } /// @nodoc @@ -110,7 +114,8 @@ class _$NotificationsStateImpl implements _NotificationsState { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$NotificationsStateImpl); } @override @@ -197,14 +202,21 @@ abstract class _NotificationsState implements NotificationsState { /// @nodoc abstract class _$$NotificationsStateEmptyImplCopyWith<$Res> { - factory _$$NotificationsStateEmptyImplCopyWith(_$NotificationsStateEmptyImpl value, $Res Function(_$NotificationsStateEmptyImpl) then) = + factory _$$NotificationsStateEmptyImplCopyWith( + _$NotificationsStateEmptyImpl value, + $Res Function(_$NotificationsStateEmptyImpl) then) = __$$NotificationsStateEmptyImplCopyWithImpl<$Res>; } /// @nodoc -class __$$NotificationsStateEmptyImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateEmptyImpl> +class __$$NotificationsStateEmptyImplCopyWithImpl<$Res> + extends _$NotificationsStateCopyWithImpl<$Res, + _$NotificationsStateEmptyImpl> implements _$$NotificationsStateEmptyImplCopyWith<$Res> { - __$$NotificationsStateEmptyImplCopyWithImpl(_$NotificationsStateEmptyImpl _value, $Res Function(_$NotificationsStateEmptyImpl) _then) : super(_value, _then); + __$$NotificationsStateEmptyImplCopyWithImpl( + _$NotificationsStateEmptyImpl _value, + $Res Function(_$NotificationsStateEmptyImpl) _then) + : super(_value, _then); } /// @nodoc @@ -219,7 +231,9 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateEmptyImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$NotificationsStateEmptyImpl); } @override @@ -306,17 +320,22 @@ abstract class NotificationsStateEmpty implements NotificationsState { /// @nodoc abstract class _$$NotificationsStateLoadedImplCopyWith<$Res> { - factory _$$NotificationsStateLoadedImplCopyWith(_$NotificationsStateLoadedImpl value, $Res Function(_$NotificationsStateLoadedImpl) then) = + factory _$$NotificationsStateLoadedImplCopyWith( + _$NotificationsStateLoadedImpl value, + $Res Function(_$NotificationsStateLoadedImpl) then) = __$$NotificationsStateLoadedImplCopyWithImpl<$Res>; - @useResult $Res call({int notificationsCount}); } /// @nodoc -class __$$NotificationsStateLoadedImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateLoadedImpl> +class __$$NotificationsStateLoadedImplCopyWithImpl<$Res> + extends _$NotificationsStateCopyWithImpl<$Res, + _$NotificationsStateLoadedImpl> implements _$$NotificationsStateLoadedImplCopyWith<$Res> { - __$$NotificationsStateLoadedImplCopyWithImpl(_$NotificationsStateLoadedImpl _value, $Res Function(_$NotificationsStateLoadedImpl) _then) + __$$NotificationsStateLoadedImplCopyWithImpl( + _$NotificationsStateLoadedImpl _value, + $Res Function(_$NotificationsStateLoadedImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -351,7 +370,8 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateLoadedImpl && - (identical(other.notificationsCount, notificationsCount) || other.notificationsCount == notificationsCount)); + (identical(other.notificationsCount, notificationsCount) || + other.notificationsCount == notificationsCount)); } @override @@ -360,8 +380,9 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> get copyWith => - __$$NotificationsStateLoadedImplCopyWithImpl<_$NotificationsStateLoadedImpl>(this, _$identity); + _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> + get copyWith => __$$NotificationsStateLoadedImplCopyWithImpl< + _$NotificationsStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs @@ -439,27 +460,34 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { } abstract class NotificationsStateLoaded implements NotificationsState { - const factory NotificationsStateLoaded({required final int notificationsCount}) = _$NotificationsStateLoadedImpl; + const factory NotificationsStateLoaded( + {required final int notificationsCount}) = _$NotificationsStateLoadedImpl; int get notificationsCount; - @JsonKey(ignore: true) - _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; + _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$NotificationsStateErrorImplCopyWith<$Res> { - factory _$$NotificationsStateErrorImplCopyWith(_$NotificationsStateErrorImpl value, $Res Function(_$NotificationsStateErrorImpl) then) = + factory _$$NotificationsStateErrorImplCopyWith( + _$NotificationsStateErrorImpl value, + $Res Function(_$NotificationsStateErrorImpl) then) = __$$NotificationsStateErrorImplCopyWithImpl<$Res>; - @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$NotificationsStateErrorImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateErrorImpl> +class __$$NotificationsStateErrorImplCopyWithImpl<$Res> + extends _$NotificationsStateCopyWithImpl<$Res, + _$NotificationsStateErrorImpl> implements _$$NotificationsStateErrorImplCopyWith<$Res> { - __$$NotificationsStateErrorImplCopyWithImpl(_$NotificationsStateErrorImpl _value, $Res Function(_$NotificationsStateErrorImpl) _then) : super(_value, _then); + __$$NotificationsStateErrorImplCopyWithImpl( + _$NotificationsStateErrorImpl _value, + $Res Function(_$NotificationsStateErrorImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -493,7 +521,8 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateErrorImpl && - (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || + other.errorMessage == errorMessage)); } @override @@ -502,8 +531,9 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> get copyWith => - __$$NotificationsStateErrorImplCopyWithImpl<_$NotificationsStateErrorImpl>(this, _$identity); + _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> + get copyWith => __$$NotificationsStateErrorImplCopyWithImpl< + _$NotificationsStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -581,10 +611,11 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError { } abstract class NotificationsStateError implements NotificationsState { - const factory NotificationsStateError({required final String errorMessage}) = _$NotificationsStateErrorImpl; + const factory NotificationsStateError({required final String errorMessage}) = + _$NotificationsStateErrorImpl; String get errorMessage; - @JsonKey(ignore: true) - _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> get copyWith => throw _privateConstructorUsedError; + _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/calendar/services/calendar_service.g.dart b/lib/features/calendar/services/calendar_service.g.dart index 4dec81f0..903145dc 100644 --- a/lib/features/calendar/services/calendar_service.g.dart +++ b/lib/features/calendar/services/calendar_service.g.dart @@ -12,38 +12,47 @@ class _CalendarService implements CalendarService { _CalendarService( this._dio, { this.baseUrl, + this.errorLogger, }); final Dio _dio; String? baseUrl; + final ParseErrorLogger? errorLogger; + @override Future> getCalendar() async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType>(Options( + final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/calendar/index', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - var _value = _result.data! - .map((dynamic i) => CalendarModel.fromJson(i as Map)) - .toList(); + .compose( + _dio.options, + '/api/calendar/index', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late List _value; + try { + _value = _result.data! + .map((dynamic i) => CalendarModel.fromJson(i as Map)) + .toList(); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } diff --git a/lib/features/chat/models/chat_message_model.freezed.dart b/lib/features/chat/models/chat_message_model.freezed.dart index 6dfda166..76a91cbc 100644 --- a/lib/features/chat/models/chat_message_model.freezed.dart +++ b/lib/features/chat/models/chat_message_model.freezed.dart @@ -21,28 +21,25 @@ ChatMessageModel _$ChatMessageModelFromJson(Map json) { /// @nodoc mixin _$ChatMessageModel { int get id => throw _privateConstructorUsedError; - String get data => throw _privateConstructorUsedError; - @JsonKey(name: 'media_data') List? get mediaData => throw _privateConstructorUsedError; - @JsonKey(name: 'author_id') int get authorId => throw _privateConstructorUsedError; - @JsonKey(name: 'updated_at') String get updatedAt => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $ChatMessageModelCopyWith get copyWith => throw _privateConstructorUsedError; + $ChatMessageModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatMessageModelCopyWith<$Res> { - factory $ChatMessageModelCopyWith(ChatMessageModel value, $Res Function(ChatMessageModel) then) = _$ChatMessageModelCopyWithImpl<$Res, ChatMessageModel>; - + factory $ChatMessageModelCopyWith( + ChatMessageModel value, $Res Function(ChatMessageModel) then) = + _$ChatMessageModelCopyWithImpl<$Res, ChatMessageModel>; @useResult $Res call( {int id, @@ -53,12 +50,12 @@ abstract class $ChatMessageModelCopyWith<$Res> { } /// @nodoc -class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel> implements $ChatMessageModelCopyWith<$Res> { +class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel> + implements $ChatMessageModelCopyWith<$Res> { _$ChatMessageModelCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -97,10 +94,11 @@ class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel> implem } /// @nodoc -abstract class _$$ChatMessageModelImplCopyWith<$Res> implements $ChatMessageModelCopyWith<$Res> { - factory _$$ChatMessageModelImplCopyWith(_$ChatMessageModelImpl value, $Res Function(_$ChatMessageModelImpl) then) = +abstract class _$$ChatMessageModelImplCopyWith<$Res> + implements $ChatMessageModelCopyWith<$Res> { + factory _$$ChatMessageModelImplCopyWith(_$ChatMessageModelImpl value, + $Res Function(_$ChatMessageModelImpl) then) = __$$ChatMessageModelImplCopyWithImpl<$Res>; - @override @useResult $Res call( @@ -112,9 +110,12 @@ abstract class _$$ChatMessageModelImplCopyWith<$Res> implements $ChatMessageMode } /// @nodoc -class __$$ChatMessageModelImplCopyWithImpl<$Res> extends _$ChatMessageModelCopyWithImpl<$Res, _$ChatMessageModelImpl> +class __$$ChatMessageModelImplCopyWithImpl<$Res> + extends _$ChatMessageModelCopyWithImpl<$Res, _$ChatMessageModelImpl> implements _$$ChatMessageModelImplCopyWith<$Res> { - __$$ChatMessageModelImplCopyWithImpl(_$ChatMessageModelImpl _value, $Res Function(_$ChatMessageModelImpl) _then) : super(_value, _then); + __$$ChatMessageModelImplCopyWithImpl(_$ChatMessageModelImpl _value, + $Res Function(_$ChatMessageModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -161,14 +162,14 @@ class _$ChatMessageModelImpl implements _ChatMessageModel { @JsonKey(name: 'updated_at') required this.updatedAt}) : _mediaData = mediaData; - factory _$ChatMessageModelImpl.fromJson(Map json) => _$$ChatMessageModelImplFromJson(json); + factory _$ChatMessageModelImpl.fromJson(Map json) => + _$$ChatMessageModelImplFromJson(json); @override final int id; @override final String data; final List? _mediaData; - @override @JsonKey(name: 'media_data') List? get mediaData { @@ -198,19 +199,25 @@ class _$ChatMessageModelImpl implements _ChatMessageModel { other is _$ChatMessageModelImpl && (identical(other.id, id) || other.id == id) && (identical(other.data, data) || other.data == data) && - const DeepCollectionEquality().equals(other._mediaData, _mediaData) && - (identical(other.authorId, authorId) || other.authorId == authorId) && - (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + const DeepCollectionEquality() + .equals(other._mediaData, _mediaData) && + (identical(other.authorId, authorId) || + other.authorId == authorId) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, data, const DeepCollectionEquality().hash(_mediaData), authorId, updatedAt); + int get hashCode => Object.hash(runtimeType, id, data, + const DeepCollectionEquality().hash(_mediaData), authorId, updatedAt); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => __$$ChatMessageModelImplCopyWithImpl<_$ChatMessageModelImpl>(this, _$identity); + _$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => + __$$ChatMessageModelImplCopyWithImpl<_$ChatMessageModelImpl>( + this, _$identity); @override Map toJson() { @@ -222,33 +229,31 @@ class _$ChatMessageModelImpl implements _ChatMessageModel { abstract class _ChatMessageModel implements ChatMessageModel { const factory _ChatMessageModel( - {required final int id, - required final String data, - @JsonKey(name: 'media_data') required final List? mediaData, - @JsonKey(name: 'author_id') required final int authorId, - @JsonKey(name: 'updated_at') required final String updatedAt}) = _$ChatMessageModelImpl; + {required final int id, + required final String data, + @JsonKey(name: 'media_data') required final List? mediaData, + @JsonKey(name: 'author_id') required final int authorId, + @JsonKey(name: 'updated_at') required final String updatedAt}) = + _$ChatMessageModelImpl; - factory _ChatMessageModel.fromJson(Map json) = _$ChatMessageModelImpl.fromJson; + factory _ChatMessageModel.fromJson(Map json) = + _$ChatMessageModelImpl.fromJson; @override int get id; - @override String get data; - @override @JsonKey(name: 'media_data') List? get mediaData; - @override @JsonKey(name: 'author_id') int get authorId; - @override @JsonKey(name: 'updated_at') String get updatedAt; - @override @JsonKey(ignore: true) - _$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_message_model.g.dart b/lib/features/chat/models/chat_message_model.g.dart index 70531099..3a8d1827 100644 --- a/lib/features/chat/models/chat_message_model.g.dart +++ b/lib/features/chat/models/chat_message_model.g.dart @@ -6,7 +6,9 @@ part of 'chat_message_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatMessageModelImpl _$$ChatMessageModelImplFromJson(Map json) => _$ChatMessageModelImpl( +_$ChatMessageModelImpl _$$ChatMessageModelImplFromJson( + Map json) => + _$ChatMessageModelImpl( id: (json['id'] as num).toInt(), data: json['data'] as String, mediaData: json['media_data'] as List?, @@ -14,7 +16,9 @@ _$ChatMessageModelImpl _$$ChatMessageModelImplFromJson(Map json updatedAt: json['updated_at'] as String, ); -Map _$$ChatMessageModelImplToJson(_$ChatMessageModelImpl instance) => { +Map _$$ChatMessageModelImplToJson( + _$ChatMessageModelImpl instance) => + { 'id': instance.id, 'data': instance.data, 'media_data': instance.mediaData, diff --git a/lib/features/chat/models/chat_meta_model.freezed.dart b/lib/features/chat/models/chat_meta_model.freezed.dart index 206048fa..11ecb9e2 100644 --- a/lib/features/chat/models/chat_meta_model.freezed.dart +++ b/lib/features/chat/models/chat_meta_model.freezed.dart @@ -24,26 +24,27 @@ mixin _$ChatMetaModel { int get lastPage => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $ChatMetaModelCopyWith get copyWith => throw _privateConstructorUsedError; + $ChatMetaModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatMetaModelCopyWith<$Res> { - factory $ChatMetaModelCopyWith(ChatMetaModel value, $Res Function(ChatMetaModel) then) = _$ChatMetaModelCopyWithImpl<$Res, ChatMetaModel>; - + factory $ChatMetaModelCopyWith( + ChatMetaModel value, $Res Function(ChatMetaModel) then) = + _$ChatMetaModelCopyWithImpl<$Res, ChatMetaModel>; @useResult $Res call({@JsonKey(name: "last_page") int lastPage}); } /// @nodoc -class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel> implements $ChatMetaModelCopyWith<$Res> { +class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel> + implements $ChatMetaModelCopyWith<$Res> { _$ChatMetaModelCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -62,17 +63,23 @@ class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel> implements $ } /// @nodoc -abstract class _$$ChatMetaModelImplCopyWith<$Res> implements $ChatMetaModelCopyWith<$Res> { - factory _$$ChatMetaModelImplCopyWith(_$ChatMetaModelImpl value, $Res Function(_$ChatMetaModelImpl) then) = __$$ChatMetaModelImplCopyWithImpl<$Res>; - +abstract class _$$ChatMetaModelImplCopyWith<$Res> + implements $ChatMetaModelCopyWith<$Res> { + factory _$$ChatMetaModelImplCopyWith( + _$ChatMetaModelImpl value, $Res Function(_$ChatMetaModelImpl) then) = + __$$ChatMetaModelImplCopyWithImpl<$Res>; @override @useResult $Res call({@JsonKey(name: "last_page") int lastPage}); } /// @nodoc -class __$$ChatMetaModelImplCopyWithImpl<$Res> extends _$ChatMetaModelCopyWithImpl<$Res, _$ChatMetaModelImpl> implements _$$ChatMetaModelImplCopyWith<$Res> { - __$$ChatMetaModelImplCopyWithImpl(_$ChatMetaModelImpl _value, $Res Function(_$ChatMetaModelImpl) _then) : super(_value, _then); +class __$$ChatMetaModelImplCopyWithImpl<$Res> + extends _$ChatMetaModelCopyWithImpl<$Res, _$ChatMetaModelImpl> + implements _$$ChatMetaModelImplCopyWith<$Res> { + __$$ChatMetaModelImplCopyWithImpl( + _$ChatMetaModelImpl _value, $Res Function(_$ChatMetaModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -91,9 +98,11 @@ class __$$ChatMetaModelImplCopyWithImpl<$Res> extends _$ChatMetaModelCopyWithImp /// @nodoc @JsonSerializable() class _$ChatMetaModelImpl implements _ChatMetaModel { - const _$ChatMetaModelImpl({@JsonKey(name: "last_page") required this.lastPage}); + const _$ChatMetaModelImpl( + {@JsonKey(name: "last_page") required this.lastPage}); - factory _$ChatMetaModelImpl.fromJson(Map json) => _$$ChatMetaModelImplFromJson(json); + factory _$ChatMetaModelImpl.fromJson(Map json) => + _$$ChatMetaModelImplFromJson(json); @override @JsonKey(name: "last_page") @@ -107,7 +116,10 @@ class _$ChatMetaModelImpl implements _ChatMetaModel { @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$ChatMetaModelImpl && (identical(other.lastPage, lastPage) || other.lastPage == lastPage)); + (other.runtimeType == runtimeType && + other is _$ChatMetaModelImpl && + (identical(other.lastPage, lastPage) || + other.lastPage == lastPage)); } @JsonKey(ignore: true) @@ -117,7 +129,8 @@ class _$ChatMetaModelImpl implements _ChatMetaModel { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => __$$ChatMetaModelImplCopyWithImpl<_$ChatMetaModelImpl>(this, _$identity); + _$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => + __$$ChatMetaModelImplCopyWithImpl<_$ChatMetaModelImpl>(this, _$identity); @override Map toJson() { @@ -128,15 +141,18 @@ class _$ChatMetaModelImpl implements _ChatMetaModel { } abstract class _ChatMetaModel implements ChatMetaModel { - const factory _ChatMetaModel({@JsonKey(name: "last_page") required final int lastPage}) = _$ChatMetaModelImpl; + const factory _ChatMetaModel( + {@JsonKey(name: "last_page") required final int lastPage}) = + _$ChatMetaModelImpl; - factory _ChatMetaModel.fromJson(Map json) = _$ChatMetaModelImpl.fromJson; + factory _ChatMetaModel.fromJson(Map json) = + _$ChatMetaModelImpl.fromJson; @override @JsonKey(name: "last_page") int get lastPage; - @override @JsonKey(ignore: true) - _$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_meta_model.g.dart b/lib/features/chat/models/chat_meta_model.g.dart index bbd16d10..7126e2dd 100644 --- a/lib/features/chat/models/chat_meta_model.g.dart +++ b/lib/features/chat/models/chat_meta_model.g.dart @@ -6,10 +6,12 @@ part of 'chat_meta_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatMetaModelImpl _$$ChatMetaModelImplFromJson(Map json) => _$ChatMetaModelImpl( +_$ChatMetaModelImpl _$$ChatMetaModelImplFromJson(Map json) => + _$ChatMetaModelImpl( lastPage: (json['last_page'] as num).toInt(), ); -Map _$$ChatMetaModelImplToJson(_$ChatMetaModelImpl instance) => { +Map _$$ChatMetaModelImplToJson(_$ChatMetaModelImpl instance) => + { 'last_page': instance.lastPage, }; diff --git a/lib/features/chat/models/chat_room_model.freezed.dart b/lib/features/chat/models/chat_room_model.freezed.dart index 26066239..5a0b6e62 100644 --- a/lib/features/chat/models/chat_room_model.freezed.dart +++ b/lib/features/chat/models/chat_room_model.freezed.dart @@ -21,35 +21,39 @@ ChatRoomModel _$ChatRoomModelFromJson(Map json) { /// @nodoc mixin _$ChatRoomModel { String get id => throw _privateConstructorUsedError; - @JsonKey(name: 'chat_room_setting') - ChatRoomSettingsModel get chatRoomSettings => throw _privateConstructorUsedError; - + ChatRoomSettingsModel get chatRoomSettings => + throw _privateConstructorUsedError; Map get users => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $ChatRoomModelCopyWith get copyWith => throw _privateConstructorUsedError; + $ChatRoomModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatRoomModelCopyWith<$Res> { - factory $ChatRoomModelCopyWith(ChatRoomModel value, $Res Function(ChatRoomModel) then) = _$ChatRoomModelCopyWithImpl<$Res, ChatRoomModel>; - + factory $ChatRoomModelCopyWith( + ChatRoomModel value, $Res Function(ChatRoomModel) then) = + _$ChatRoomModelCopyWithImpl<$Res, ChatRoomModel>; @useResult - $Res call({String id, @JsonKey(name: 'chat_room_setting') ChatRoomSettingsModel chatRoomSettings, Map users}); + $Res call( + {String id, + @JsonKey(name: 'chat_room_setting') + ChatRoomSettingsModel chatRoomSettings, + Map users}); $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings; } /// @nodoc -class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> implements $ChatRoomModelCopyWith<$Res> { +class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> + implements $ChatRoomModelCopyWith<$Res> { _$ChatRoomModelCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -79,27 +83,38 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> implements $ @override @pragma('vm:prefer-inline') $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings { - return $ChatRoomSettingsModelCopyWith<$Res>(_value.chatRoomSettings, (value) { + return $ChatRoomSettingsModelCopyWith<$Res>(_value.chatRoomSettings, + (value) { return _then(_value.copyWith(chatRoomSettings: value) as $Val); }); } } /// @nodoc -abstract class _$$ChatRoomModelImplCopyWith<$Res> implements $ChatRoomModelCopyWith<$Res> { - factory _$$ChatRoomModelImplCopyWith(_$ChatRoomModelImpl value, $Res Function(_$ChatRoomModelImpl) then) = __$$ChatRoomModelImplCopyWithImpl<$Res>; - +abstract class _$$ChatRoomModelImplCopyWith<$Res> + implements $ChatRoomModelCopyWith<$Res> { + factory _$$ChatRoomModelImplCopyWith( + _$ChatRoomModelImpl value, $Res Function(_$ChatRoomModelImpl) then) = + __$$ChatRoomModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({String id, @JsonKey(name: 'chat_room_setting') ChatRoomSettingsModel chatRoomSettings, Map users}); + $Res call( + {String id, + @JsonKey(name: 'chat_room_setting') + ChatRoomSettingsModel chatRoomSettings, + Map users}); @override $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings; } /// @nodoc -class __$$ChatRoomModelImplCopyWithImpl<$Res> extends _$ChatRoomModelCopyWithImpl<$Res, _$ChatRoomModelImpl> implements _$$ChatRoomModelImplCopyWith<$Res> { - __$$ChatRoomModelImplCopyWithImpl(_$ChatRoomModelImpl _value, $Res Function(_$ChatRoomModelImpl) _then) : super(_value, _then); +class __$$ChatRoomModelImplCopyWithImpl<$Res> + extends _$ChatRoomModelCopyWithImpl<$Res, _$ChatRoomModelImpl> + implements _$$ChatRoomModelImplCopyWith<$Res> { + __$$ChatRoomModelImplCopyWithImpl( + _$ChatRoomModelImpl _value, $Res Function(_$ChatRoomModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -129,10 +144,13 @@ class __$$ChatRoomModelImplCopyWithImpl<$Res> extends _$ChatRoomModelCopyWithImp @JsonSerializable() class _$ChatRoomModelImpl implements _ChatRoomModel { const _$ChatRoomModelImpl( - {required this.id, @JsonKey(name: 'chat_room_setting') required this.chatRoomSettings, required final Map users}) + {required this.id, + @JsonKey(name: 'chat_room_setting') required this.chatRoomSettings, + required final Map users}) : _users = users; - factory _$ChatRoomModelImpl.fromJson(Map json) => _$$ChatRoomModelImplFromJson(json); + factory _$ChatRoomModelImpl.fromJson(Map json) => + _$$ChatRoomModelImplFromJson(json); @override final String id; @@ -140,7 +158,6 @@ class _$ChatRoomModelImpl implements _ChatRoomModel { @JsonKey(name: 'chat_room_setting') final ChatRoomSettingsModel chatRoomSettings; final Map _users; - @override Map get users { if (_users is EqualUnmodifiableMapView) return _users; @@ -159,18 +176,21 @@ class _$ChatRoomModelImpl implements _ChatRoomModel { (other.runtimeType == runtimeType && other is _$ChatRoomModelImpl && (identical(other.id, id) || other.id == id) && - (identical(other.chatRoomSettings, chatRoomSettings) || other.chatRoomSettings == chatRoomSettings) && + (identical(other.chatRoomSettings, chatRoomSettings) || + other.chatRoomSettings == chatRoomSettings) && const DeepCollectionEquality().equals(other._users, _users)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, chatRoomSettings, const DeepCollectionEquality().hash(_users)); + int get hashCode => Object.hash(runtimeType, id, chatRoomSettings, + const DeepCollectionEquality().hash(_users)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => __$$ChatRoomModelImplCopyWithImpl<_$ChatRoomModelImpl>(this, _$identity); + _$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => + __$$ChatRoomModelImplCopyWithImpl<_$ChatRoomModelImpl>(this, _$identity); @override Map toJson() { @@ -183,22 +203,22 @@ class _$ChatRoomModelImpl implements _ChatRoomModel { abstract class _ChatRoomModel implements ChatRoomModel { const factory _ChatRoomModel( {required final String id, - @JsonKey(name: 'chat_room_setting') required final ChatRoomSettingsModel chatRoomSettings, + @JsonKey(name: 'chat_room_setting') + required final ChatRoomSettingsModel chatRoomSettings, required final Map users}) = _$ChatRoomModelImpl; - factory _ChatRoomModel.fromJson(Map json) = _$ChatRoomModelImpl.fromJson; + factory _ChatRoomModel.fromJson(Map json) = + _$ChatRoomModelImpl.fromJson; @override String get id; - @override @JsonKey(name: 'chat_room_setting') ChatRoomSettingsModel get chatRoomSettings; - @override Map get users; - @override @JsonKey(ignore: true) - _$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_room_model.g.dart b/lib/features/chat/models/chat_room_model.g.dart index 6230d4f4..68d3195c 100644 --- a/lib/features/chat/models/chat_room_model.g.dart +++ b/lib/features/chat/models/chat_room_model.g.dart @@ -6,15 +6,19 @@ part of 'chat_room_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatRoomModelImpl _$$ChatRoomModelImplFromJson(Map json) => _$ChatRoomModelImpl( +_$ChatRoomModelImpl _$$ChatRoomModelImplFromJson(Map json) => + _$ChatRoomModelImpl( id: json['id'] as String, - chatRoomSettings: ChatRoomSettingsModel.fromJson(json['chat_room_setting'] as Map), + chatRoomSettings: ChatRoomSettingsModel.fromJson( + json['chat_room_setting'] as Map), users: (json['users'] as Map).map( - (k, e) => MapEntry(k, ChatUserModel.fromJson(e as Map)), + (k, e) => + MapEntry(k, ChatUserModel.fromJson(e as Map)), ), ); -Map _$$ChatRoomModelImplToJson(_$ChatRoomModelImpl instance) => { +Map _$$ChatRoomModelImplToJson(_$ChatRoomModelImpl instance) => + { 'id': instance.id, 'chat_room_setting': instance.chatRoomSettings, 'users': instance.users, diff --git a/lib/features/chat/models/chat_room_settings_model.freezed.dart b/lib/features/chat/models/chat_room_settings_model.freezed.dart index 48a11456..4f217556 100644 --- a/lib/features/chat/models/chat_room_settings_model.freezed.dart +++ b/lib/features/chat/models/chat_room_settings_model.freezed.dart @@ -14,36 +14,33 @@ T _$identity(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'); -ChatRoomSettingsModel _$ChatRoomSettingsModelFromJson(Map json) { +ChatRoomSettingsModel _$ChatRoomSettingsModelFromJson( + Map json) { return _ChatRoomSettingsModel.fromJson(json); } /// @nodoc mixin _$ChatRoomSettingsModel { int get id => throw _privateConstructorUsedError; - @JsonKey(name: 'room_name') String get roomName => throw _privateConstructorUsedError; - String get state => throw _privateConstructorUsedError; - @JsonKey(name: 'access_level') String get accessLevel => throw _privateConstructorUsedError; - @JsonKey(name: 'updated_at') String get updatedAt => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $ChatRoomSettingsModelCopyWith get copyWith => throw _privateConstructorUsedError; + $ChatRoomSettingsModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatRoomSettingsModelCopyWith<$Res> { - factory $ChatRoomSettingsModelCopyWith(ChatRoomSettingsModel value, $Res Function(ChatRoomSettingsModel) then) = + factory $ChatRoomSettingsModelCopyWith(ChatRoomSettingsModel value, + $Res Function(ChatRoomSettingsModel) then) = _$ChatRoomSettingsModelCopyWithImpl<$Res, ChatRoomSettingsModel>; - @useResult $Res call( {int id, @@ -54,12 +51,13 @@ abstract class $ChatRoomSettingsModelCopyWith<$Res> { } /// @nodoc -class _$ChatRoomSettingsModelCopyWithImpl<$Res, $Val extends ChatRoomSettingsModel> implements $ChatRoomSettingsModelCopyWith<$Res> { +class _$ChatRoomSettingsModelCopyWithImpl<$Res, + $Val extends ChatRoomSettingsModel> + implements $ChatRoomSettingsModelCopyWith<$Res> { _$ChatRoomSettingsModelCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -98,10 +96,12 @@ class _$ChatRoomSettingsModelCopyWithImpl<$Res, $Val extends ChatRoomSettingsMod } /// @nodoc -abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res> implements $ChatRoomSettingsModelCopyWith<$Res> { - factory _$$ChatRoomSettingsModelImplCopyWith(_$ChatRoomSettingsModelImpl value, $Res Function(_$ChatRoomSettingsModelImpl) then) = +abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res> + implements $ChatRoomSettingsModelCopyWith<$Res> { + factory _$$ChatRoomSettingsModelImplCopyWith( + _$ChatRoomSettingsModelImpl value, + $Res Function(_$ChatRoomSettingsModelImpl) then) = __$$ChatRoomSettingsModelImplCopyWithImpl<$Res>; - @override @useResult $Res call( @@ -113,9 +113,13 @@ abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res> implements $ChatRoomSe } /// @nodoc -class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res> extends _$ChatRoomSettingsModelCopyWithImpl<$Res, _$ChatRoomSettingsModelImpl> +class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res> + extends _$ChatRoomSettingsModelCopyWithImpl<$Res, + _$ChatRoomSettingsModelImpl> implements _$$ChatRoomSettingsModelImplCopyWith<$Res> { - __$$ChatRoomSettingsModelImplCopyWithImpl(_$ChatRoomSettingsModelImpl _value, $Res Function(_$ChatRoomSettingsModelImpl) _then) : super(_value, _then); + __$$ChatRoomSettingsModelImplCopyWithImpl(_$ChatRoomSettingsModelImpl _value, + $Res Function(_$ChatRoomSettingsModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -161,7 +165,8 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel { @JsonKey(name: 'access_level') required this.accessLevel, @JsonKey(name: 'updated_at') required this.updatedAt}); - factory _$ChatRoomSettingsModelImpl.fromJson(Map json) => _$$ChatRoomSettingsModelImplFromJson(json); + factory _$ChatRoomSettingsModelImpl.fromJson(Map json) => + _$$ChatRoomSettingsModelImplFromJson(json); @override final int id; @@ -188,21 +193,26 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel { (other.runtimeType == runtimeType && other is _$ChatRoomSettingsModelImpl && (identical(other.id, id) || other.id == id) && - (identical(other.roomName, roomName) || other.roomName == roomName) && + (identical(other.roomName, roomName) || + other.roomName == roomName) && (identical(other.state, state) || other.state == state) && - (identical(other.accessLevel, accessLevel) || other.accessLevel == accessLevel) && - (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + (identical(other.accessLevel, accessLevel) || + other.accessLevel == accessLevel) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, roomName, state, accessLevel, updatedAt); + int get hashCode => + Object.hash(runtimeType, id, roomName, state, accessLevel, updatedAt); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> get copyWith => - __$$ChatRoomSettingsModelImplCopyWithImpl<_$ChatRoomSettingsModelImpl>(this, _$identity); + _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> + get copyWith => __$$ChatRoomSettingsModelImplCopyWithImpl< + _$ChatRoomSettingsModelImpl>(this, _$identity); @override Map toJson() { @@ -214,33 +224,31 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel { abstract class _ChatRoomSettingsModel implements ChatRoomSettingsModel { const factory _ChatRoomSettingsModel( - {required final int id, - @JsonKey(name: 'room_name') required final String roomName, - required final String state, - @JsonKey(name: 'access_level') required final String accessLevel, - @JsonKey(name: 'updated_at') required final String updatedAt}) = _$ChatRoomSettingsModelImpl; + {required final int id, + @JsonKey(name: 'room_name') required final String roomName, + required final String state, + @JsonKey(name: 'access_level') required final String accessLevel, + @JsonKey(name: 'updated_at') required final String updatedAt}) = + _$ChatRoomSettingsModelImpl; - factory _ChatRoomSettingsModel.fromJson(Map json) = _$ChatRoomSettingsModelImpl.fromJson; + factory _ChatRoomSettingsModel.fromJson(Map json) = + _$ChatRoomSettingsModelImpl.fromJson; @override int get id; - @override @JsonKey(name: 'room_name') String get roomName; - @override String get state; - @override @JsonKey(name: 'access_level') String get accessLevel; - @override @JsonKey(name: 'updated_at') String get updatedAt; - @override @JsonKey(ignore: true) - _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_room_settings_model.g.dart b/lib/features/chat/models/chat_room_settings_model.g.dart index 1a2ef327..7b824334 100644 --- a/lib/features/chat/models/chat_room_settings_model.g.dart +++ b/lib/features/chat/models/chat_room_settings_model.g.dart @@ -6,7 +6,9 @@ part of 'chat_room_settings_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson(Map json) => _$ChatRoomSettingsModelImpl( +_$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson( + Map json) => + _$ChatRoomSettingsModelImpl( id: (json['id'] as num).toInt(), roomName: json['room_name'] as String, state: json['state'] as String, @@ -14,7 +16,9 @@ _$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson(Map _$$ChatRoomSettingsModelImplToJson(_$ChatRoomSettingsModelImpl instance) => { +Map _$$ChatRoomSettingsModelImplToJson( + _$ChatRoomSettingsModelImpl instance) => + { 'id': instance.id, 'room_name': instance.roomName, 'state': instance.state, diff --git a/lib/features/chat/models/chat_user_model.freezed.dart b/lib/features/chat/models/chat_user_model.freezed.dart index 90774932..095c09e2 100644 --- a/lib/features/chat/models/chat_user_model.freezed.dart +++ b/lib/features/chat/models/chat_user_model.freezed.dart @@ -21,36 +21,38 @@ ChatUserModel _$ChatUserModelFromJson(Map json) { /// @nodoc mixin _$ChatUserModel { int get id => throw _privateConstructorUsedError; - String get name => throw _privateConstructorUsedError; - @JsonKey(name: 'profile_photo_path') String? get profilePhotoPath => throw _privateConstructorUsedError; - @JsonKey(name: 'profile_photo_url') String? get profilePhotoUrl => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $ChatUserModelCopyWith get copyWith => throw _privateConstructorUsedError; + $ChatUserModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatUserModelCopyWith<$Res> { - factory $ChatUserModelCopyWith(ChatUserModel value, $Res Function(ChatUserModel) then) = _$ChatUserModelCopyWithImpl<$Res, ChatUserModel>; - + factory $ChatUserModelCopyWith( + ChatUserModel value, $Res Function(ChatUserModel) then) = + _$ChatUserModelCopyWithImpl<$Res, ChatUserModel>; @useResult - $Res call({int id, String name, @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); + $Res call( + {int id, + String name, + @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, + @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); } /// @nodoc -class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel> implements $ChatUserModelCopyWith<$Res> { +class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel> + implements $ChatUserModelCopyWith<$Res> { _$ChatUserModelCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -84,17 +86,27 @@ class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel> implements $ } /// @nodoc -abstract class _$$ChatUserModelImplCopyWith<$Res> implements $ChatUserModelCopyWith<$Res> { - factory _$$ChatUserModelImplCopyWith(_$ChatUserModelImpl value, $Res Function(_$ChatUserModelImpl) then) = __$$ChatUserModelImplCopyWithImpl<$Res>; - +abstract class _$$ChatUserModelImplCopyWith<$Res> + implements $ChatUserModelCopyWith<$Res> { + factory _$$ChatUserModelImplCopyWith( + _$ChatUserModelImpl value, $Res Function(_$ChatUserModelImpl) then) = + __$$ChatUserModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({int id, String name, @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); + $Res call( + {int id, + String name, + @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, + @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); } /// @nodoc -class __$$ChatUserModelImplCopyWithImpl<$Res> extends _$ChatUserModelCopyWithImpl<$Res, _$ChatUserModelImpl> implements _$$ChatUserModelImplCopyWith<$Res> { - __$$ChatUserModelImplCopyWithImpl(_$ChatUserModelImpl _value, $Res Function(_$ChatUserModelImpl) _then) : super(_value, _then); +class __$$ChatUserModelImplCopyWithImpl<$Res> + extends _$ChatUserModelCopyWithImpl<$Res, _$ChatUserModelImpl> + implements _$$ChatUserModelImplCopyWith<$Res> { + __$$ChatUserModelImplCopyWithImpl( + _$ChatUserModelImpl _value, $Res Function(_$ChatUserModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -134,7 +146,8 @@ class _$ChatUserModelImpl implements _ChatUserModel { @JsonKey(name: 'profile_photo_path') this.profilePhotoPath, @JsonKey(name: 'profile_photo_url') this.profilePhotoUrl}); - factory _$ChatUserModelImpl.fromJson(Map json) => _$$ChatUserModelImplFromJson(json); + factory _$ChatUserModelImpl.fromJson(Map json) => + _$$ChatUserModelImplFromJson(json); @override final int id; @@ -159,18 +172,22 @@ class _$ChatUserModelImpl implements _ChatUserModel { other is _$ChatUserModelImpl && (identical(other.id, id) || other.id == id) && (identical(other.name, name) || other.name == name) && - (identical(other.profilePhotoPath, profilePhotoPath) || other.profilePhotoPath == profilePhotoPath) && - (identical(other.profilePhotoUrl, profilePhotoUrl) || other.profilePhotoUrl == profilePhotoUrl)); + (identical(other.profilePhotoPath, profilePhotoPath) || + other.profilePhotoPath == profilePhotoPath) && + (identical(other.profilePhotoUrl, profilePhotoUrl) || + other.profilePhotoUrl == profilePhotoUrl)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, name, profilePhotoPath, profilePhotoUrl); + int get hashCode => + Object.hash(runtimeType, id, name, profilePhotoPath, profilePhotoUrl); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => __$$ChatUserModelImplCopyWithImpl<_$ChatUserModelImpl>(this, _$identity); + _$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => + __$$ChatUserModelImplCopyWithImpl<_$ChatUserModelImpl>(this, _$identity); @override Map toJson() { @@ -182,28 +199,27 @@ class _$ChatUserModelImpl implements _ChatUserModel { abstract class _ChatUserModel implements ChatUserModel { const factory _ChatUserModel( - {required final int id, - required final String name, - @JsonKey(name: 'profile_photo_path') final String? profilePhotoPath, - @JsonKey(name: 'profile_photo_url') final String? profilePhotoUrl}) = _$ChatUserModelImpl; + {required final int id, + required final String name, + @JsonKey(name: 'profile_photo_path') final String? profilePhotoPath, + @JsonKey(name: 'profile_photo_url') final String? profilePhotoUrl}) = + _$ChatUserModelImpl; - factory _ChatUserModel.fromJson(Map json) = _$ChatUserModelImpl.fromJson; + factory _ChatUserModel.fromJson(Map json) = + _$ChatUserModelImpl.fromJson; @override int get id; - @override String get name; - @override @JsonKey(name: 'profile_photo_path') String? get profilePhotoPath; - @override @JsonKey(name: 'profile_photo_url') String? get profilePhotoUrl; - @override @JsonKey(ignore: true) - _$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_user_model.g.dart b/lib/features/chat/models/chat_user_model.g.dart index 06fa92a0..78e0f981 100644 --- a/lib/features/chat/models/chat_user_model.g.dart +++ b/lib/features/chat/models/chat_user_model.g.dart @@ -6,14 +6,16 @@ part of 'chat_user_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatUserModelImpl _$$ChatUserModelImplFromJson(Map json) => _$ChatUserModelImpl( +_$ChatUserModelImpl _$$ChatUserModelImplFromJson(Map json) => + _$ChatUserModelImpl( id: (json['id'] as num).toInt(), name: json['name'] as String, profilePhotoPath: json['profile_photo_path'] as String?, profilePhotoUrl: json['profile_photo_url'] as String?, ); -Map _$$ChatUserModelImplToJson(_$ChatUserModelImpl instance) => { +Map _$$ChatUserModelImplToJson(_$ChatUserModelImpl instance) => + { 'id': instance.id, 'name': instance.name, 'profile_photo_path': instance.profilePhotoPath, diff --git a/lib/features/chat/models/websocket_info_model.freezed.dart b/lib/features/chat/models/websocket_info_model.freezed.dart index 002f2ec5..cd383a2b 100644 --- a/lib/features/chat/models/websocket_info_model.freezed.dart +++ b/lib/features/chat/models/websocket_info_model.freezed.dart @@ -21,38 +21,39 @@ WebsocketInfoModel _$WebsocketInfoModelFromJson(Map json) { /// @nodoc mixin _$WebsocketInfoModel { String get key => throw _privateConstructorUsedError; - String get host => throw _privateConstructorUsedError; - String get port => throw _privateConstructorUsedError; - String get cluster => throw _privateConstructorUsedError; - @JsonKey(name: 'user_id') int get userId => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $WebsocketInfoModelCopyWith get copyWith => throw _privateConstructorUsedError; + $WebsocketInfoModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $WebsocketInfoModelCopyWith<$Res> { - factory $WebsocketInfoModelCopyWith(WebsocketInfoModel value, $Res Function(WebsocketInfoModel) then) = + factory $WebsocketInfoModelCopyWith( + WebsocketInfoModel value, $Res Function(WebsocketInfoModel) then) = _$WebsocketInfoModelCopyWithImpl<$Res, WebsocketInfoModel>; - @useResult - $Res call({String key, String host, String port, String cluster, @JsonKey(name: 'user_id') int userId}); + $Res call( + {String key, + String host, + String port, + String cluster, + @JsonKey(name: 'user_id') int userId}); } /// @nodoc -class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel> implements $WebsocketInfoModelCopyWith<$Res> { +class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel> + implements $WebsocketInfoModelCopyWith<$Res> { _$WebsocketInfoModelCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -91,19 +92,28 @@ class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel> im } /// @nodoc -abstract class _$$WebsocketInfoModelImplCopyWith<$Res> implements $WebsocketInfoModelCopyWith<$Res> { - factory _$$WebsocketInfoModelImplCopyWith(_$WebsocketInfoModelImpl value, $Res Function(_$WebsocketInfoModelImpl) then) = +abstract class _$$WebsocketInfoModelImplCopyWith<$Res> + implements $WebsocketInfoModelCopyWith<$Res> { + factory _$$WebsocketInfoModelImplCopyWith(_$WebsocketInfoModelImpl value, + $Res Function(_$WebsocketInfoModelImpl) then) = __$$WebsocketInfoModelImplCopyWithImpl<$Res>; - @override @useResult - $Res call({String key, String host, String port, String cluster, @JsonKey(name: 'user_id') int userId}); + $Res call( + {String key, + String host, + String port, + String cluster, + @JsonKey(name: 'user_id') int userId}); } /// @nodoc -class __$$WebsocketInfoModelImplCopyWithImpl<$Res> extends _$WebsocketInfoModelCopyWithImpl<$Res, _$WebsocketInfoModelImpl> +class __$$WebsocketInfoModelImplCopyWithImpl<$Res> + extends _$WebsocketInfoModelCopyWithImpl<$Res, _$WebsocketInfoModelImpl> implements _$$WebsocketInfoModelImplCopyWith<$Res> { - __$$WebsocketInfoModelImplCopyWithImpl(_$WebsocketInfoModelImpl _value, $Res Function(_$WebsocketInfoModelImpl) _then) : super(_value, _then); + __$$WebsocketInfoModelImplCopyWithImpl(_$WebsocketInfoModelImpl _value, + $Res Function(_$WebsocketInfoModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -143,9 +153,14 @@ class __$$WebsocketInfoModelImplCopyWithImpl<$Res> extends _$WebsocketInfoModelC @JsonSerializable() class _$WebsocketInfoModelImpl implements _WebsocketInfoModel { const _$WebsocketInfoModelImpl( - {required this.key, required this.host, required this.port, required this.cluster, @JsonKey(name: 'user_id') required this.userId}); + {required this.key, + required this.host, + required this.port, + required this.cluster, + @JsonKey(name: 'user_id') required this.userId}); - factory _$WebsocketInfoModelImpl.fromJson(Map json) => _$$WebsocketInfoModelImplFromJson(json); + factory _$WebsocketInfoModelImpl.fromJson(Map json) => + _$$WebsocketInfoModelImplFromJson(json); @override final String key; @@ -178,13 +193,15 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel { @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, key, host, port, cluster, userId); + int get hashCode => + Object.hash(runtimeType, key, host, port, cluster, userId); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') _$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith => - __$$WebsocketInfoModelImplCopyWithImpl<_$WebsocketInfoModelImpl>(this, _$identity); + __$$WebsocketInfoModelImplCopyWithImpl<_$WebsocketInfoModelImpl>( + this, _$identity); @override Map toJson() { @@ -196,31 +213,29 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel { abstract class _WebsocketInfoModel implements WebsocketInfoModel { const factory _WebsocketInfoModel( - {required final String key, - required final String host, - required final String port, - required final String cluster, - @JsonKey(name: 'user_id') required final int userId}) = _$WebsocketInfoModelImpl; + {required final String key, + required final String host, + required final String port, + required final String cluster, + @JsonKey(name: 'user_id') required final int userId}) = + _$WebsocketInfoModelImpl; - factory _WebsocketInfoModel.fromJson(Map json) = _$WebsocketInfoModelImpl.fromJson; + factory _WebsocketInfoModel.fromJson(Map json) = + _$WebsocketInfoModelImpl.fromJson; @override String get key; - @override String get host; - @override String get port; - @override String get cluster; - @override @JsonKey(name: 'user_id') int get userId; - @override @JsonKey(ignore: true) - _$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/websocket_info_model.g.dart b/lib/features/chat/models/websocket_info_model.g.dart index 91c386f8..b2bb1248 100644 --- a/lib/features/chat/models/websocket_info_model.g.dart +++ b/lib/features/chat/models/websocket_info_model.g.dart @@ -6,7 +6,9 @@ part of 'websocket_info_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson(Map json) => _$WebsocketInfoModelImpl( +_$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson( + Map json) => + _$WebsocketInfoModelImpl( key: json['key'] as String, host: json['host'] as String, port: json['port'] as String, @@ -14,7 +16,9 @@ _$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson(Map userId: (json['user_id'] as num).toInt(), ); -Map _$$WebsocketInfoModelImplToJson(_$WebsocketInfoModelImpl instance) => { +Map _$$WebsocketInfoModelImplToJson( + _$WebsocketInfoModelImpl instance) => + { 'key': instance.key, 'host': instance.host, 'port': instance.port, diff --git a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart index aaf9a4e9..4f83ea35 100644 --- a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart +++ b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart @@ -138,10 +138,14 @@ class ChatRoomCubit extends Cubit { sendMessage({ required String chatId, - required String data, - required List filesList, + String? data, + List? files, }) async { - await chatRepository.sendMessage(chatId: chatId, data: data); + await chatRepository.sendMessage( + chatId: chatId, + data: data, + files: files, + ); } @override diff --git a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart index 0001c80c..43bf9df9 100644 --- a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart +++ b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart @@ -20,16 +20,19 @@ mixin _$ChatRoomState { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, + required TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) => throw _privateConstructorUsedError; - @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult? Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) => throw _privateConstructorUsedError; @@ -37,7 +40,9 @@ mixin _$ChatRoomState { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) => @@ -71,28 +76,36 @@ mixin _$ChatRoomState { /// @nodoc abstract class $ChatRoomStateCopyWith<$Res> { - factory $ChatRoomStateCopyWith(ChatRoomState value, $Res Function(ChatRoomState) then) = _$ChatRoomStateCopyWithImpl<$Res, ChatRoomState>; + factory $ChatRoomStateCopyWith( + ChatRoomState value, $Res Function(ChatRoomState) then) = + _$ChatRoomStateCopyWithImpl<$Res, ChatRoomState>; } /// @nodoc -class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState> implements $ChatRoomStateCopyWith<$Res> { +class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState> + implements $ChatRoomStateCopyWith<$Res> { _$ChatRoomStateCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; } /// @nodoc abstract class _$$ChatRoomStateImplCopyWith<$Res> { - factory _$$ChatRoomStateImplCopyWith(_$ChatRoomStateImpl value, $Res Function(_$ChatRoomStateImpl) then) = __$$ChatRoomStateImplCopyWithImpl<$Res>; + factory _$$ChatRoomStateImplCopyWith( + _$ChatRoomStateImpl value, $Res Function(_$ChatRoomStateImpl) then) = + __$$ChatRoomStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$ChatRoomStateImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateImpl> implements _$$ChatRoomStateImplCopyWith<$Res> { - __$$ChatRoomStateImplCopyWithImpl(_$ChatRoomStateImpl _value, $Res Function(_$ChatRoomStateImpl) _then) : super(_value, _then); +class __$$ChatRoomStateImplCopyWithImpl<$Res> + extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateImpl> + implements _$$ChatRoomStateImplCopyWith<$Res> { + __$$ChatRoomStateImplCopyWithImpl( + _$ChatRoomStateImpl _value, $Res Function(_$ChatRoomStateImpl) _then) + : super(_value, _then); } /// @nodoc @@ -107,7 +120,8 @@ class _$ChatRoomStateImpl implements _ChatRoomState { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$ChatRoomStateImpl); } @override @@ -118,7 +132,9 @@ class _$ChatRoomStateImpl implements _ChatRoomState { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, + required TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return $default(); @@ -129,7 +145,9 @@ class _$ChatRoomStateImpl implements _ChatRoomState { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult? Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return $default?.call(); @@ -140,7 +158,9 @@ class _$ChatRoomStateImpl implements _ChatRoomState { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -194,14 +214,18 @@ abstract class _ChatRoomState implements ChatRoomState { /// @nodoc abstract class _$$ChatRoomStateLoadingImplCopyWith<$Res> { - factory _$$ChatRoomStateLoadingImplCopyWith(_$ChatRoomStateLoadingImpl value, $Res Function(_$ChatRoomStateLoadingImpl) then) = + factory _$$ChatRoomStateLoadingImplCopyWith(_$ChatRoomStateLoadingImpl value, + $Res Function(_$ChatRoomStateLoadingImpl) then) = __$$ChatRoomStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc -class __$$ChatRoomStateLoadingImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadingImpl> +class __$$ChatRoomStateLoadingImplCopyWithImpl<$Res> + extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadingImpl> implements _$$ChatRoomStateLoadingImplCopyWith<$Res> { - __$$ChatRoomStateLoadingImplCopyWithImpl(_$ChatRoomStateLoadingImpl _value, $Res Function(_$ChatRoomStateLoadingImpl) _then) : super(_value, _then); + __$$ChatRoomStateLoadingImplCopyWithImpl(_$ChatRoomStateLoadingImpl _value, + $Res Function(_$ChatRoomStateLoadingImpl) _then) + : super(_value, _then); } /// @nodoc @@ -216,7 +240,9 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateLoadingImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ChatRoomStateLoadingImpl); } @override @@ -227,7 +253,9 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, + required TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return loading(); @@ -238,7 +266,9 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult? Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return loading?.call(); @@ -249,7 +279,9 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -303,19 +335,26 @@ abstract class ChatRoomStateLoading implements ChatRoomState { /// @nodoc abstract class _$$ChatRoomStateLoadedImplCopyWith<$Res> { - factory _$$ChatRoomStateLoadedImplCopyWith(_$ChatRoomStateLoadedImpl value, $Res Function(_$ChatRoomStateLoadedImpl) then) = + factory _$$ChatRoomStateLoadedImplCopyWith(_$ChatRoomStateLoadedImpl value, + $Res Function(_$ChatRoomStateLoadedImpl) then) = __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>; - @useResult - $Res call({ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading}); + $Res call( + {ChatRoomModel chatRoom, + List chatMessages, + bool isTyping, + bool isLoading}); $ChatRoomModelCopyWith<$Res> get chatRoom; } /// @nodoc -class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadedImpl> +class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> + extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadedImpl> implements _$$ChatRoomStateLoadedImplCopyWith<$Res> { - __$$ChatRoomStateLoadedImplCopyWithImpl(_$ChatRoomStateLoadedImpl _value, $Res Function(_$ChatRoomStateLoadedImpl) _then) : super(_value, _then); + __$$ChatRoomStateLoadedImplCopyWithImpl(_$ChatRoomStateLoadedImpl _value, + $Res Function(_$ChatRoomStateLoadedImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -357,13 +396,16 @@ class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyW /// @nodoc class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { - const _$ChatRoomStateLoadedImpl({required this.chatRoom, required final List chatMessages, required this.isTyping, required this.isLoading}) + const _$ChatRoomStateLoadedImpl( + {required this.chatRoom, + required final List chatMessages, + required this.isTyping, + required this.isLoading}) : _chatMessages = chatMessages; @override final ChatRoomModel chatRoom; final List _chatMessages; - @override List get chatMessages { if (_chatMessages is EqualUnmodifiableListView) return _chatMessages; @@ -386,27 +428,35 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateLoadedImpl && - (identical(other.chatRoom, chatRoom) || other.chatRoom == chatRoom) && - const DeepCollectionEquality().equals(other._chatMessages, _chatMessages) && - (identical(other.isTyping, isTyping) || other.isTyping == isTyping) && - (identical(other.isLoading, isLoading) || other.isLoading == isLoading)); + (identical(other.chatRoom, chatRoom) || + other.chatRoom == chatRoom) && + const DeepCollectionEquality() + .equals(other._chatMessages, _chatMessages) && + (identical(other.isTyping, isTyping) || + other.isTyping == isTyping) && + (identical(other.isLoading, isLoading) || + other.isLoading == isLoading)); } @override - int get hashCode => Object.hash(runtimeType, chatRoom, const DeepCollectionEquality().hash(_chatMessages), isTyping, isLoading); + int get hashCode => Object.hash(runtimeType, chatRoom, + const DeepCollectionEquality().hash(_chatMessages), isTyping, isLoading); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') _$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith => - __$$ChatRoomStateLoadedImplCopyWithImpl<_$ChatRoomStateLoadedImpl>(this, _$identity); + __$$ChatRoomStateLoadedImplCopyWithImpl<_$ChatRoomStateLoadedImpl>( + this, _$identity); @override @optionalTypeArgs TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, + required TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return loaded(chatRoom, chatMessages, isTyping, isLoading); @@ -417,7 +467,9 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult? Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return loaded?.call(chatRoom, chatMessages, isTyping, isLoading); @@ -428,7 +480,9 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -484,30 +538,30 @@ abstract class ChatRoomStateLoaded implements ChatRoomState { required final bool isLoading}) = _$ChatRoomStateLoadedImpl; ChatRoomModel get chatRoom; - List get chatMessages; - bool get isTyping; - bool get isLoading; - @JsonKey(ignore: true) - _$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class _$$ChatRoomStateErrorImplCopyWith<$Res> { - factory _$$ChatRoomStateErrorImplCopyWith(_$ChatRoomStateErrorImpl value, $Res Function(_$ChatRoomStateErrorImpl) then) = + factory _$$ChatRoomStateErrorImplCopyWith(_$ChatRoomStateErrorImpl value, + $Res Function(_$ChatRoomStateErrorImpl) then) = __$$ChatRoomStateErrorImplCopyWithImpl<$Res>; - @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$ChatRoomStateErrorImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateErrorImpl> +class __$$ChatRoomStateErrorImplCopyWithImpl<$Res> + extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateErrorImpl> implements _$$ChatRoomStateErrorImplCopyWith<$Res> { - __$$ChatRoomStateErrorImplCopyWithImpl(_$ChatRoomStateErrorImpl _value, $Res Function(_$ChatRoomStateErrorImpl) _then) : super(_value, _then); + __$$ChatRoomStateErrorImplCopyWithImpl(_$ChatRoomStateErrorImpl _value, + $Res Function(_$ChatRoomStateErrorImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -541,7 +595,8 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateErrorImpl && - (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || + other.errorMessage == errorMessage)); } @override @@ -551,14 +606,17 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { @override @pragma('vm:prefer-inline') _$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith => - __$$ChatRoomStateErrorImplCopyWithImpl<_$ChatRoomStateErrorImpl>(this, _$identity); + __$$ChatRoomStateErrorImplCopyWithImpl<_$ChatRoomStateErrorImpl>( + this, _$identity); @override @optionalTypeArgs TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, + required TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return error(errorMessage); @@ -569,7 +627,9 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult? Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return error?.call(errorMessage); @@ -580,7 +640,9 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -629,10 +691,11 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { } abstract class ChatRoomStateError implements ChatRoomState { - const factory ChatRoomStateError({required final String errorMessage}) = _$ChatRoomStateErrorImpl; + const factory ChatRoomStateError({required final String errorMessage}) = + _$ChatRoomStateErrorImpl; String get errorMessage; - @JsonKey(ignore: true) - _$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/chat/presentation/pages/chat_screen.dart b/lib/features/chat/presentation/pages/chat_screen.dart index e6822c50..692365b0 100644 --- a/lib/features/chat/presentation/pages/chat_screen.dart +++ b/lib/features/chat/presentation/pages/chat_screen.dart @@ -1,8 +1,11 @@ +import 'dart:io'; + import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart'; import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.dart'; import 'package:eatvio_app/features/chat/presentation/widgets/chat_bubble_widget.dart'; import 'package:eatvio_app/locator_service.dart'; +import 'package:file_picker/file_picker.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:lazy_load_scrollview/lazy_load_scrollview.dart'; @@ -124,6 +127,7 @@ class _ChatScreenState extends State { (context, index) { if (index < state.chatMessages.length) { return ChatBubbleWidget( + sendTime: state.chatMessages[index].updatedAt, text: state.chatMessages[index].data.trim(), isCurrentUser: state.chatRoom.users['to_chat_user']!.id != state.chatMessages[index].authorId, mediaData: state.chatMessages[index].mediaData ?? [], @@ -144,14 +148,33 @@ class _ChatScreenState extends State { ), ), ), - Padding( + Container( padding: EdgeInsets.symmetric(vertical: 8), + decoration: BoxDecoration( + border: Border( + top: BorderSide( + color: Colors.black.withOpacity(0.1), + ), + ), + ), child: Row( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.end, children: [ SizedBox(width: 8), InkWell( - onTap: () {}, + onTap: () async { + FilePickerResult? result = await FilePicker.platform.pickFiles(); + + if (result != null) { + File file = File(result.files.single.path!); + context.read().sendMessage( + chatId: widget.chatId, + files: [file], + ); + } else { + // User canceled the picker + } + }, borderRadius: BorderRadius.circular(16), child: Ink( height: 32, @@ -171,17 +194,15 @@ class _ChatScreenState extends State { maxLines: 5, minLines: 1, keyboardType: TextInputType.multiline, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w400, - color: Colors.black, - ), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1), decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 4), + isDense: true, + contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 8), hintText: 'Сообщение', hintStyle: TextStyle( fontSize: 16, fontWeight: FontWeight.w400, + height: 1, color: Color(0xFFAEAEB2), ), filled: true, @@ -215,10 +236,9 @@ class _ChatScreenState extends State { onTap: () { if (textEditingController.text.isNotEmpty) { context.read().sendMessage( - chatId: widget.chatId, - data: textEditingController.text.trim(), - filesList: [], - ); + chatId: widget.chatId, + data: textEditingController.text.trim(), + ); setState(() { textEditingController.clear(); }); diff --git a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart index 555aa23b..f65fb3bc 100644 --- a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart +++ b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart @@ -9,11 +9,13 @@ import 'package:url_launcher/url_launcher.dart'; class ChatBubbleWidget extends StatelessWidget { const ChatBubbleWidget({ super.key, + required this.sendTime, required this.text, required this.isCurrentUser, required this.mediaData, }); + final String sendTime; final String text; final bool isCurrentUser; final List mediaData; diff --git a/lib/features/chat/repositories/chat_repository.dart b/lib/features/chat/repositories/chat_repository.dart index c35847f2..6252ad4c 100644 --- a/lib/features/chat/repositories/chat_repository.dart +++ b/lib/features/chat/repositories/chat_repository.dart @@ -15,13 +15,13 @@ class ChatRepository { Future sendMessage({ required String chatId, String? data, - List? filesList, + List? files, }) async { try { await chatService.sendMessage( id: chatId, data: data, - filesList: filesList, + mediaData: files, ); } catch (e) { print(e); diff --git a/lib/features/chat/services/chat_service.dart b/lib/features/chat/services/chat_service.dart index 888aaba0..9a1514f4 100644 --- a/lib/features/chat/services/chat_service.dart +++ b/lib/features/chat/services/chat_service.dart @@ -18,10 +18,11 @@ abstract class ChatService { }); @POST('/api/chat/{id}/message/send') + @MultiPart() Future sendMessage({ @Path() required String id, @Part() String? data, - @Part() List? filesList, + @Part() List? mediaData, }); @GET('/api/chat/show/{id}/messages?page={page}') diff --git a/lib/features/chat/services/chat_service.g.dart b/lib/features/chat/services/chat_service.g.dart index 2f0674be..e0493dd3 100644 --- a/lib/features/chat/services/chat_service.g.dart +++ b/lib/features/chat/services/chat_service.g.dart @@ -12,37 +12,46 @@ class _ChatService implements ChatService { _ChatService( this._dio, { this.baseUrl, + this.errorLogger, }); final Dio _dio; String? baseUrl; + final ParseErrorLogger? errorLogger; + @override Future> getChatRoom({required String id}) async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>( - _setStreamType>(Options( + final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/chat/show/${id}', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - var _value = _result.data!.map((k, dynamic v) => - MapEntry(k, ChatRoomModel.fromJson(v as Map))); + .compose( + _dio.options, + '/api/chat/show/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late Map _value; + try { + _value = _result.data!.map((k, dynamic v) => + MapEntry(k, ChatRoomModel.fromJson(v as Map))); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -50,7 +59,7 @@ class _ChatService implements ChatService { Future sendMessage({ required String id, String? data, - List? filesList, + List? mediaData, }) async { final _extra = {}; final queryParameters = {}; @@ -63,18 +72,19 @@ class _ChatService implements ChatService { data, )); } - if (filesList != null) { - _data.files.addAll(filesList.map((i) => MapEntry( - 'filesList', + if (mediaData != null) { + _data.files.addAll(mediaData.map((i) => MapEntry( + 'mediaData', MultipartFile.fromFileSync( i.path, filename: i.path.split(Platform.pathSeparator).last, )))); } - await _dio.fetch(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'POST', headers: _headers, extra: _extra, + contentType: 'multipart/form-data', ) .compose( _dio.options, @@ -86,7 +96,8 @@ class _ChatService implements ChatService { baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, - )))); + ))); + await _dio.fetch(_options); } @override @@ -98,24 +109,30 @@ class _ChatService implements ChatService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/chat/show/${id}/messages?page=${page}', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = ChatMessagesModel.fromJson(_result.data!); + .compose( + _dio.options, + '/api/chat/show/${id}/messages?page=${page}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late ChatMessagesModel _value; + try { + _value = ChatMessagesModel.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -125,24 +142,30 @@ class _ChatService implements ChatService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/profile/ws/params', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = WebsocketInfoModel.fromJson(_result.data!); + .compose( + _dio.options, + '/api/profile/ws/params', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late WebsocketInfoModel _value; + try { + _value = WebsocketInfoModel.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } diff --git a/lib/features/diary/models/photo.freezed.dart b/lib/features/diary/models/photo.freezed.dart index 81cbdd37..2d9c70bd 100644 --- a/lib/features/diary/models/photo.freezed.dart +++ b/lib/features/diary/models/photo.freezed.dart @@ -21,33 +21,33 @@ Photo _$PhotoFromJson(Map json) { /// @nodoc mixin _$Photo { int get id => throw _privateConstructorUsedError; - @JsonKey(name: 'original_name') String get originalName => throw _privateConstructorUsedError; - String get path => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) $PhotoCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $PhotoCopyWith<$Res> { - factory $PhotoCopyWith(Photo value, $Res Function(Photo) then) = _$PhotoCopyWithImpl<$Res, Photo>; - + factory $PhotoCopyWith(Photo value, $Res Function(Photo) then) = + _$PhotoCopyWithImpl<$Res, Photo>; @useResult - $Res call({int id, @JsonKey(name: 'original_name') String originalName, String path}); + $Res call( + {int id, + @JsonKey(name: 'original_name') String originalName, + String path}); } /// @nodoc -class _$PhotoCopyWithImpl<$Res, $Val extends Photo> implements $PhotoCopyWith<$Res> { +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; @@ -77,16 +77,24 @@ class _$PhotoCopyWithImpl<$Res, $Val extends Photo> implements $PhotoCopyWith<$R /// @nodoc abstract class _$$PhotoImplCopyWith<$Res> implements $PhotoCopyWith<$Res> { - factory _$$PhotoImplCopyWith(_$PhotoImpl value, $Res Function(_$PhotoImpl) then) = __$$PhotoImplCopyWithImpl<$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}); + $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); +class __$$PhotoImplCopyWithImpl<$Res> + extends _$PhotoCopyWithImpl<$Res, _$PhotoImpl> + implements _$$PhotoImplCopyWith<$Res> { + __$$PhotoImplCopyWithImpl( + _$PhotoImpl _value, $Res Function(_$PhotoImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -115,9 +123,13 @@ class __$$PhotoImplCopyWithImpl<$Res> extends _$PhotoCopyWithImpl<$Res, _$PhotoI /// @nodoc @JsonSerializable() class _$PhotoImpl implements _Photo { - const _$PhotoImpl({required this.id, @JsonKey(name: 'original_name') required this.originalName, required this.path}); + const _$PhotoImpl( + {required this.id, + @JsonKey(name: 'original_name') required this.originalName, + required this.path}); - factory _$PhotoImpl.fromJson(Map json) => _$$PhotoImplFromJson(json); + factory _$PhotoImpl.fromJson(Map json) => + _$$PhotoImplFromJson(json); @override final int id; @@ -138,7 +150,8 @@ class _$PhotoImpl implements _Photo { (other.runtimeType == runtimeType && other is _$PhotoImpl && (identical(other.id, id) || other.id == id) && - (identical(other.originalName, originalName) || other.originalName == originalName) && + (identical(other.originalName, originalName) || + other.originalName == originalName) && (identical(other.path, path) || other.path == path)); } @@ -149,7 +162,8 @@ class _$PhotoImpl implements _Photo { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$PhotoImplCopyWith<_$PhotoImpl> get copyWith => __$$PhotoImplCopyWithImpl<_$PhotoImpl>(this, _$identity); + _$$PhotoImplCopyWith<_$PhotoImpl> get copyWith => + __$$PhotoImplCopyWithImpl<_$PhotoImpl>(this, _$identity); @override Map toJson() { @@ -160,21 +174,22 @@ class _$PhotoImpl implements _Photo { } 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; + const factory _Photo( + {required final int id, + @JsonKey(name: 'original_name') required final String originalName, + required final String path}) = _$PhotoImpl; factory _Photo.fromJson(Map json) = _$PhotoImpl.fromJson; @override int get id; - @override @JsonKey(name: 'original_name') String get originalName; - @override String get path; - @override @JsonKey(ignore: true) - _$$PhotoImplCopyWith<_$PhotoImpl> get copyWith => throw _privateConstructorUsedError; + _$$PhotoImplCopyWith<_$PhotoImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/diary/models/photo.g.dart b/lib/features/diary/models/photo.g.dart index 1efd15ed..cacf65ac 100644 --- a/lib/features/diary/models/photo.g.dart +++ b/lib/features/diary/models/photo.g.dart @@ -12,7 +12,8 @@ _$PhotoImpl _$$PhotoImplFromJson(Map json) => _$PhotoImpl( path: json['path'] as String, ); -Map _$$PhotoImplToJson(_$PhotoImpl instance) => { +Map _$$PhotoImplToJson(_$PhotoImpl instance) => + { 'id': instance.id, 'original_name': instance.originalName, 'path': instance.path, diff --git a/lib/features/diary/services/diary_service.g.dart b/lib/features/diary/services/diary_service.g.dart index aba060cd..8c1039c0 100644 --- a/lib/features/diary/services/diary_service.g.dart +++ b/lib/features/diary/services/diary_service.g.dart @@ -12,36 +12,45 @@ class _DiaryService implements DiaryService { _DiaryService( this._dio, { this.baseUrl, + this.errorLogger, }); final Dio _dio; String? baseUrl; + final ParseErrorLogger? errorLogger; + @override Future> getDiaryID() async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType>(Options( + final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/diary/index', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = _result.data!.cast(); + .compose( + _dio.options, + '/api/diary/index', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late Map _value; + try { + _value = _result.data!.cast(); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -51,25 +60,31 @@ class _DiaryService implements DiaryService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>( - _setStreamType>(Options( + final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/diary/${id}/show/', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - var _value = _result.data!.map((k, dynamic v) => - MapEntry(k, DiaryModel.fromJson(v as Map))); + .compose( + _dio.options, + '/api/diary/${id}/show/', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late Map _value; + try { + _value = _result.data!.map((k, dynamic v) => + MapEntry(k, DiaryModel.fromJson(v as Map))); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -79,7 +94,7 @@ class _DiaryService implements DiaryService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, @@ -94,7 +109,8 @@ class _DiaryService implements DiaryService { baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, - )))); + ))); + final _result = await _dio.fetch(_options); final _value = _result.data; return _value; } @@ -105,28 +121,34 @@ class _DiaryService implements DiaryService { final queryParameters = {r'name': name}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>( - _setStreamType>>(Options( + final _options = _setStreamType>>(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/diary/product_nutritional_values/filter', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - var _value = _result.data!.map((k, dynamic v) => MapEntry( - k, - (v as List) - .map((i) => Product.fromJson(i as Map)) - .toList())); + .compose( + _dio.options, + '/api/diary/product_nutritional_values/filter', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late Map> _value; + try { + _value = _result.data!.map((k, dynamic v) => MapEntry( + k, + (v as List) + .map((i) => Product.fromJson(i as Map)) + .toList())); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -140,24 +162,30 @@ class _DiaryService implements DiaryService { final queryParameters = {r'satiety': satiety}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType>(Options( + final _options = _setStreamType>(Options( method: 'POST', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/diary/${diary_id}/meal/${meal_id}/satiety/fill', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = _result.data!.cast(); + .compose( + _dio.options, + '/api/diary/${diary_id}/meal/${meal_id}/satiety/fill', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late Map _value; + try { + _value = _result.data!.cast(); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -171,24 +199,30 @@ class _DiaryService implements DiaryService { final queryParameters = {r'mood': mood}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType>(Options( + final _options = _setStreamType>(Options( method: 'POST', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/diary/${diary_id}/meal/${meal_id}/mood/fill', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = _result.data!.cast(); + .compose( + _dio.options, + '/api/diary/${diary_id}/meal/${meal_id}/mood/fill', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late Map _value; + try { + _value = _result.data!.cast(); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -201,24 +235,30 @@ class _DiaryService implements DiaryService { final queryParameters = {r'wakeup': wakeup}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'POST', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/diary/${diary_id}/wakeup/fill', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = DiaryModel.fromJson(_result.data!); + .compose( + _dio.options, + '/api/diary/${diary_id}/wakeup/fill', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late DiaryModel _value; + try { + _value = DiaryModel.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -231,24 +271,30 @@ class _DiaryService implements DiaryService { final queryParameters = {r'retire': retire}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'POST', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/diary/${diary_id}/retire/fill', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = DiaryModel.fromJson(_result.data!); + .compose( + _dio.options, + '/api/diary/${diary_id}/retire/fill', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late DiaryModel _value; + try { + _value = DiaryModel.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -268,25 +314,31 @@ class _DiaryService implements DiaryService { }; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>( - _setStreamType>(Options( + final _options = _setStreamType>(Options( method: 'POST', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/diary/${diary_id}/meal/${meal_id}/portions/create', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - var _value = _result.data!.map((k, dynamic v) => - MapEntry(k, Portion.fromJson(v as Map))); + .compose( + _dio.options, + '/api/diary/${diary_id}/meal/${meal_id}/portions/create', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late Map _value; + try { + _value = _result.data!.map((k, dynamic v) => + MapEntry(k, Portion.fromJson(v as Map))); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -307,7 +359,7 @@ class _DiaryService implements DiaryService { filename: photo.path.split(Platform.pathSeparator).last, ), )); - await _dio.fetch(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'POST', headers: _headers, extra: _extra, @@ -322,7 +374,8 @@ class _DiaryService implements DiaryService { baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, - )))); + ))); + await _dio.fetch(_options); } @override @@ -343,24 +396,30 @@ class _DiaryService implements DiaryService { }; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>( - _setStreamType>(Options( + final _options = _setStreamType>(Options( method: 'POST', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/diary/product_nutritional_values/sendToModeration', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = _result.data!.cast(); + .compose( + _dio.options, + '/api/diary/product_nutritional_values/sendToModeration', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late Map _value; + try { + _value = _result.data!.cast(); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -370,7 +429,7 @@ class _DiaryService implements DiaryService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - await _dio.fetch(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'POST', headers: _headers, extra: _extra, @@ -385,7 +444,8 @@ class _DiaryService implements DiaryService { baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, - )))); + ))); + await _dio.fetch(_options); } @override @@ -398,7 +458,7 @@ class _DiaryService implements DiaryService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - await _dio.fetch(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'DELETE', headers: _headers, extra: _extra, @@ -413,7 +473,8 @@ class _DiaryService implements DiaryService { baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, - )))); + ))); + await _dio.fetch(_options); } @override @@ -430,7 +491,7 @@ class _DiaryService implements DiaryService { }; final _headers = {}; const Map? _data = null; - await _dio.fetch(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'DELETE', headers: _headers, extra: _extra, @@ -445,7 +506,8 @@ class _DiaryService implements DiaryService { baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, - )))); + ))); + await _dio.fetch(_options); } RequestOptions _setStreamType(RequestOptions requestOptions) { diff --git a/lib/features/feed/models/diets_pagination_model.freezed.dart b/lib/features/feed/models/diets_pagination_model.freezed.dart index c6965ee7..2c402671 100644 --- a/lib/features/feed/models/diets_pagination_model.freezed.dart +++ b/lib/features/feed/models/diets_pagination_model.freezed.dart @@ -22,38 +22,39 @@ DietsPagination _$DietsPaginationFromJson(Map json) { mixin _$DietsPagination { @JsonKey(name: "data") List get data => throw _privateConstructorUsedError; - @JsonKey(name: "links") Links get links => throw _privateConstructorUsedError; - @JsonKey(name: "meta") Meta get meta => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $DietsPaginationCopyWith get copyWith => throw _privateConstructorUsedError; + $DietsPaginationCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $DietsPaginationCopyWith<$Res> { - factory $DietsPaginationCopyWith(DietsPagination value, $Res Function(DietsPagination) then) = _$DietsPaginationCopyWithImpl<$Res, DietsPagination>; - + factory $DietsPaginationCopyWith( + DietsPagination value, $Res Function(DietsPagination) then) = + _$DietsPaginationCopyWithImpl<$Res, DietsPagination>; @useResult - $Res call({@JsonKey(name: "data") List data, @JsonKey(name: "links") Links links, @JsonKey(name: "meta") Meta meta}); + $Res call( + {@JsonKey(name: "data") List data, + @JsonKey(name: "links") Links links, + @JsonKey(name: "meta") Meta meta}); $LinksCopyWith<$Res> get links; - $MetaCopyWith<$Res> get meta; } /// @nodoc -class _$DietsPaginationCopyWithImpl<$Res, $Val extends DietsPagination> implements $DietsPaginationCopyWith<$Res> { +class _$DietsPaginationCopyWithImpl<$Res, $Val extends DietsPagination> + implements $DietsPaginationCopyWith<$Res> { _$DietsPaginationCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -98,24 +99,31 @@ class _$DietsPaginationCopyWithImpl<$Res, $Val extends DietsPagination> implemen } /// @nodoc -abstract class _$$DietsPaginationImplCopyWith<$Res> implements $DietsPaginationCopyWith<$Res> { - factory _$$DietsPaginationImplCopyWith(_$DietsPaginationImpl value, $Res Function(_$DietsPaginationImpl) then) = __$$DietsPaginationImplCopyWithImpl<$Res>; - +abstract class _$$DietsPaginationImplCopyWith<$Res> + implements $DietsPaginationCopyWith<$Res> { + factory _$$DietsPaginationImplCopyWith(_$DietsPaginationImpl value, + $Res Function(_$DietsPaginationImpl) then) = + __$$DietsPaginationImplCopyWithImpl<$Res>; @override @useResult - $Res call({@JsonKey(name: "data") List data, @JsonKey(name: "links") Links links, @JsonKey(name: "meta") Meta meta}); + $Res call( + {@JsonKey(name: "data") List data, + @JsonKey(name: "links") Links links, + @JsonKey(name: "meta") Meta meta}); @override $LinksCopyWith<$Res> get links; - @override $MetaCopyWith<$Res> get meta; } /// @nodoc -class __$$DietsPaginationImplCopyWithImpl<$Res> extends _$DietsPaginationCopyWithImpl<$Res, _$DietsPaginationImpl> +class __$$DietsPaginationImplCopyWithImpl<$Res> + extends _$DietsPaginationCopyWithImpl<$Res, _$DietsPaginationImpl> implements _$$DietsPaginationImplCopyWith<$Res> { - __$$DietsPaginationImplCopyWithImpl(_$DietsPaginationImpl _value, $Res Function(_$DietsPaginationImpl) _then) : super(_value, _then); + __$$DietsPaginationImplCopyWithImpl( + _$DietsPaginationImpl _value, $Res Function(_$DietsPaginationImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -145,13 +153,15 @@ class __$$DietsPaginationImplCopyWithImpl<$Res> extends _$DietsPaginationCopyWit @JsonSerializable() class _$DietsPaginationImpl implements _DietsPagination { const _$DietsPaginationImpl( - {@JsonKey(name: "data") required final List data, @JsonKey(name: "links") required this.links, @JsonKey(name: "meta") required this.meta}) + {@JsonKey(name: "data") required final List data, + @JsonKey(name: "links") required this.links, + @JsonKey(name: "meta") required this.meta}) : _data = data; - factory _$DietsPaginationImpl.fromJson(Map json) => _$$DietsPaginationImplFromJson(json); + factory _$DietsPaginationImpl.fromJson(Map json) => + _$$DietsPaginationImplFromJson(json); final List _data; - @override @JsonKey(name: "data") List get data { @@ -184,12 +194,15 @@ class _$DietsPaginationImpl implements _DietsPagination { @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_data), links, meta); + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(_data), links, meta); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$DietsPaginationImplCopyWith<_$DietsPaginationImpl> get copyWith => __$$DietsPaginationImplCopyWithImpl<_$DietsPaginationImpl>(this, _$identity); + _$$DietsPaginationImplCopyWith<_$DietsPaginationImpl> get copyWith => + __$$DietsPaginationImplCopyWithImpl<_$DietsPaginationImpl>( + this, _$identity); @override Map toJson() { @@ -205,23 +218,22 @@ abstract class _DietsPagination implements DietsPagination { @JsonKey(name: "links") required final Links links, @JsonKey(name: "meta") required final Meta meta}) = _$DietsPaginationImpl; - factory _DietsPagination.fromJson(Map json) = _$DietsPaginationImpl.fromJson; + factory _DietsPagination.fromJson(Map json) = + _$DietsPaginationImpl.fromJson; @override @JsonKey(name: "data") List get data; - @override @JsonKey(name: "links") Links get links; - @override @JsonKey(name: "meta") Meta get meta; - @override @JsonKey(ignore: true) - _$$DietsPaginationImplCopyWith<_$DietsPaginationImpl> get copyWith => throw _privateConstructorUsedError; + _$$DietsPaginationImplCopyWith<_$DietsPaginationImpl> get copyWith => + throw _privateConstructorUsedError; } Datum _$DatumFromJson(Map json) { @@ -232,50 +244,39 @@ Datum _$DatumFromJson(Map json) { mixin _$Datum { @JsonKey(name: "id") int get id => throw _privateConstructorUsedError; - @JsonKey(name: "name") String get name => throw _privateConstructorUsedError; - @JsonKey(name: "image") String get image => throw _privateConstructorUsedError; - @JsonKey(name: "duration") int get duration => throw _privateConstructorUsedError; - @JsonKey(name: "state") String get state => throw _privateConstructorUsedError; - @JsonKey(name: "type") Type get type => throw _privateConstructorUsedError; - @JsonKey(name: "details") String get details => throw _privateConstructorUsedError; - @JsonKey(name: "daily_schedule") - List>> get dailySchedule => throw _privateConstructorUsedError; - + List>> get dailySchedule => + throw _privateConstructorUsedError; @JsonKey(name: "author") Author get author => throw _privateConstructorUsedError; - @JsonKey(name: "total_likes") int get totalLikes => throw _privateConstructorUsedError; - @JsonKey(name: "total_views") int get totalViews => throw _privateConstructorUsedError; - @JsonKey(name: "total_comments") int get totalComments => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) $DatumCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $DatumCopyWith<$Res> { - factory $DatumCopyWith(Datum value, $Res Function(Datum) then) = _$DatumCopyWithImpl<$Res, Datum>; - + factory $DatumCopyWith(Datum value, $Res Function(Datum) then) = + _$DatumCopyWithImpl<$Res, Datum>; @useResult $Res call( {@JsonKey(name: "id") int id, @@ -285,24 +286,24 @@ abstract class $DatumCopyWith<$Res> { @JsonKey(name: "state") String state, @JsonKey(name: "type") Type type, @JsonKey(name: "details") String details, - @JsonKey(name: "daily_schedule") List>> dailySchedule, + @JsonKey(name: "daily_schedule") + List>> dailySchedule, @JsonKey(name: "author") Author author, @JsonKey(name: "total_likes") int totalLikes, @JsonKey(name: "total_views") int totalViews, @JsonKey(name: "total_comments") int totalComments}); $TypeCopyWith<$Res> get type; - $AuthorCopyWith<$Res> get author; } /// @nodoc -class _$DatumCopyWithImpl<$Res, $Val extends Datum> implements $DatumCopyWith<$Res> { +class _$DatumCopyWithImpl<$Res, $Val extends Datum> + implements $DatumCopyWith<$Res> { _$DatumCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -393,8 +394,9 @@ class _$DatumCopyWithImpl<$Res, $Val extends Datum> implements $DatumCopyWith<$R /// @nodoc abstract class _$$DatumImplCopyWith<$Res> implements $DatumCopyWith<$Res> { - factory _$$DatumImplCopyWith(_$DatumImpl value, $Res Function(_$DatumImpl) then) = __$$DatumImplCopyWithImpl<$Res>; - + factory _$$DatumImplCopyWith( + _$DatumImpl value, $Res Function(_$DatumImpl) then) = + __$$DatumImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -405,7 +407,8 @@ abstract class _$$DatumImplCopyWith<$Res> implements $DatumCopyWith<$Res> { @JsonKey(name: "state") String state, @JsonKey(name: "type") Type type, @JsonKey(name: "details") String details, - @JsonKey(name: "daily_schedule") List>> dailySchedule, + @JsonKey(name: "daily_schedule") + List>> dailySchedule, @JsonKey(name: "author") Author author, @JsonKey(name: "total_likes") int totalLikes, @JsonKey(name: "total_views") int totalViews, @@ -413,14 +416,17 @@ abstract class _$$DatumImplCopyWith<$Res> implements $DatumCopyWith<$Res> { @override $TypeCopyWith<$Res> get type; - @override $AuthorCopyWith<$Res> get author; } /// @nodoc -class __$$DatumImplCopyWithImpl<$Res> extends _$DatumCopyWithImpl<$Res, _$DatumImpl> implements _$$DatumImplCopyWith<$Res> { - __$$DatumImplCopyWithImpl(_$DatumImpl _value, $Res Function(_$DatumImpl) _then) : super(_value, _then); +class __$$DatumImplCopyWithImpl<$Res> + extends _$DatumCopyWithImpl<$Res, _$DatumImpl> + implements _$$DatumImplCopyWith<$Res> { + __$$DatumImplCopyWithImpl( + _$DatumImpl _value, $Res Function(_$DatumImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -502,14 +508,16 @@ class _$DatumImpl implements _Datum { @JsonKey(name: "state") required this.state, @JsonKey(name: "type") required this.type, @JsonKey(name: "details") required this.details, - @JsonKey(name: "daily_schedule") required final List>> dailySchedule, + @JsonKey(name: "daily_schedule") + required final List>> dailySchedule, @JsonKey(name: "author") required this.author, @JsonKey(name: "total_likes") required this.totalLikes, @JsonKey(name: "total_views") required this.totalViews, @JsonKey(name: "total_comments") required this.totalComments}) : _dailySchedule = dailySchedule; - factory _$DatumImpl.fromJson(Map json) => _$$DatumImplFromJson(json); + factory _$DatumImpl.fromJson(Map json) => + _$$DatumImplFromJson(json); @override @JsonKey(name: "id") @@ -533,7 +541,6 @@ class _$DatumImpl implements _Datum { @JsonKey(name: "details") final String details; final List>> _dailySchedule; - @override @JsonKey(name: "daily_schedule") List>> get dailySchedule { @@ -568,26 +575,44 @@ class _$DatumImpl implements _Datum { (identical(other.id, id) || other.id == id) && (identical(other.name, name) || other.name == name) && (identical(other.image, image) || other.image == image) && - (identical(other.duration, duration) || other.duration == duration) && + (identical(other.duration, duration) || + other.duration == duration) && (identical(other.state, state) || other.state == state) && (identical(other.type, type) || other.type == type) && (identical(other.details, details) || other.details == details) && - const DeepCollectionEquality().equals(other._dailySchedule, _dailySchedule) && + const DeepCollectionEquality() + .equals(other._dailySchedule, _dailySchedule) && (identical(other.author, author) || other.author == author) && - (identical(other.totalLikes, totalLikes) || other.totalLikes == totalLikes) && - (identical(other.totalViews, totalViews) || other.totalViews == totalViews) && - (identical(other.totalComments, totalComments) || other.totalComments == totalComments)); + (identical(other.totalLikes, totalLikes) || + other.totalLikes == totalLikes) && + (identical(other.totalViews, totalViews) || + other.totalViews == totalViews) && + (identical(other.totalComments, totalComments) || + other.totalComments == totalComments)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, name, image, duration, state, type, details, const DeepCollectionEquality().hash(_dailySchedule), author, - totalLikes, totalViews, totalComments); + int get hashCode => Object.hash( + runtimeType, + id, + name, + image, + duration, + state, + type, + details, + const DeepCollectionEquality().hash(_dailySchedule), + author, + totalLikes, + totalViews, + totalComments); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$DatumImplCopyWith<_$DatumImpl> get copyWith => __$$DatumImplCopyWithImpl<_$DatumImpl>(this, _$identity); + _$$DatumImplCopyWith<_$DatumImpl> get copyWith => + __$$DatumImplCopyWithImpl<_$DatumImpl>(this, _$identity); @override Map toJson() { @@ -599,72 +624,63 @@ class _$DatumImpl implements _Datum { abstract class _Datum implements Datum { const factory _Datum( - {@JsonKey(name: "id") required final int id, - @JsonKey(name: "name") required final String name, - @JsonKey(name: "image") required final String image, - @JsonKey(name: "duration") required final int duration, - @JsonKey(name: "state") required final String state, - @JsonKey(name: "type") required final Type type, - @JsonKey(name: "details") required final String details, - @JsonKey(name: "daily_schedule") required final List>> dailySchedule, - @JsonKey(name: "author") required final Author author, - @JsonKey(name: "total_likes") required final int totalLikes, - @JsonKey(name: "total_views") required final int totalViews, - @JsonKey(name: "total_comments") required final int totalComments}) = _$DatumImpl; + {@JsonKey(name: "id") required final int id, + @JsonKey(name: "name") required final String name, + @JsonKey(name: "image") required final String image, + @JsonKey(name: "duration") required final int duration, + @JsonKey(name: "state") required final String state, + @JsonKey(name: "type") required final Type type, + @JsonKey(name: "details") required final String details, + @JsonKey(name: "daily_schedule") + required final List>> dailySchedule, + @JsonKey(name: "author") required final Author author, + @JsonKey(name: "total_likes") required final int totalLikes, + @JsonKey(name: "total_views") required final int totalViews, + @JsonKey(name: "total_comments") required final int totalComments}) = + _$DatumImpl; factory _Datum.fromJson(Map json) = _$DatumImpl.fromJson; @override @JsonKey(name: "id") int get id; - @override @JsonKey(name: "name") String get name; - @override @JsonKey(name: "image") String get image; - @override @JsonKey(name: "duration") int get duration; - @override @JsonKey(name: "state") String get state; - @override @JsonKey(name: "type") Type get type; - @override @JsonKey(name: "details") String get details; - @override @JsonKey(name: "daily_schedule") List>> get dailySchedule; - @override @JsonKey(name: "author") Author get author; - @override @JsonKey(name: "total_likes") int get totalLikes; - @override @JsonKey(name: "total_views") int get totalViews; - @override @JsonKey(name: "total_comments") int get totalComments; - @override @JsonKey(ignore: true) - _$$DatumImplCopyWith<_$DatumImpl> get copyWith => throw _privateConstructorUsedError; + _$$DatumImplCopyWith<_$DatumImpl> get copyWith => + throw _privateConstructorUsedError; } Author _$AuthorFromJson(Map json) { @@ -675,26 +691,22 @@ Author _$AuthorFromJson(Map json) { mixin _$Author { @JsonKey(name: "author_slug") String get authorSlug => throw _privateConstructorUsedError; - @JsonKey(name: "author_name") String get authorName => throw _privateConstructorUsedError; - @JsonKey(name: "author_profile_icon") String get authorProfileIcon => throw _privateConstructorUsedError; - @JsonKey(name: "author_is_me") bool get authorIsMe => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) $AuthorCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $AuthorCopyWith<$Res> { - factory $AuthorCopyWith(Author value, $Res Function(Author) then) = _$AuthorCopyWithImpl<$Res, Author>; - + factory $AuthorCopyWith(Author value, $Res Function(Author) then) = + _$AuthorCopyWithImpl<$Res, Author>; @useResult $Res call( {@JsonKey(name: "author_slug") String authorSlug, @@ -704,12 +716,12 @@ abstract class $AuthorCopyWith<$Res> { } /// @nodoc -class _$AuthorCopyWithImpl<$Res, $Val extends Author> implements $AuthorCopyWith<$Res> { +class _$AuthorCopyWithImpl<$Res, $Val extends Author> + implements $AuthorCopyWith<$Res> { _$AuthorCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -744,8 +756,9 @@ class _$AuthorCopyWithImpl<$Res, $Val extends Author> implements $AuthorCopyWith /// @nodoc abstract class _$$AuthorImplCopyWith<$Res> implements $AuthorCopyWith<$Res> { - factory _$$AuthorImplCopyWith(_$AuthorImpl value, $Res Function(_$AuthorImpl) then) = __$$AuthorImplCopyWithImpl<$Res>; - + factory _$$AuthorImplCopyWith( + _$AuthorImpl value, $Res Function(_$AuthorImpl) then) = + __$$AuthorImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -756,8 +769,12 @@ abstract class _$$AuthorImplCopyWith<$Res> implements $AuthorCopyWith<$Res> { } /// @nodoc -class __$$AuthorImplCopyWithImpl<$Res> extends _$AuthorCopyWithImpl<$Res, _$AuthorImpl> implements _$$AuthorImplCopyWith<$Res> { - __$$AuthorImplCopyWithImpl(_$AuthorImpl _value, $Res Function(_$AuthorImpl) _then) : super(_value, _then); +class __$$AuthorImplCopyWithImpl<$Res> + extends _$AuthorCopyWithImpl<$Res, _$AuthorImpl> + implements _$$AuthorImplCopyWith<$Res> { + __$$AuthorImplCopyWithImpl( + _$AuthorImpl _value, $Res Function(_$AuthorImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -797,7 +814,8 @@ class _$AuthorImpl implements _Author { @JsonKey(name: "author_profile_icon") required this.authorProfileIcon, @JsonKey(name: "author_is_me") required this.authorIsMe}); - factory _$AuthorImpl.fromJson(Map json) => _$$AuthorImplFromJson(json); + factory _$AuthorImpl.fromJson(Map json) => + _$$AuthorImplFromJson(json); @override @JsonKey(name: "author_slug") @@ -822,20 +840,26 @@ class _$AuthorImpl implements _Author { return identical(this, other) || (other.runtimeType == runtimeType && other is _$AuthorImpl && - (identical(other.authorSlug, authorSlug) || other.authorSlug == authorSlug) && - (identical(other.authorName, authorName) || other.authorName == authorName) && - (identical(other.authorProfileIcon, authorProfileIcon) || other.authorProfileIcon == authorProfileIcon) && - (identical(other.authorIsMe, authorIsMe) || other.authorIsMe == authorIsMe)); + (identical(other.authorSlug, authorSlug) || + other.authorSlug == authorSlug) && + (identical(other.authorName, authorName) || + other.authorName == authorName) && + (identical(other.authorProfileIcon, authorProfileIcon) || + other.authorProfileIcon == authorProfileIcon) && + (identical(other.authorIsMe, authorIsMe) || + other.authorIsMe == authorIsMe)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, authorSlug, authorName, authorProfileIcon, authorIsMe); + int get hashCode => Object.hash( + runtimeType, authorSlug, authorName, authorProfileIcon, authorIsMe); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$AuthorImplCopyWith<_$AuthorImpl> get copyWith => __$$AuthorImplCopyWithImpl<_$AuthorImpl>(this, _$identity); + _$$AuthorImplCopyWith<_$AuthorImpl> get copyWith => + __$$AuthorImplCopyWithImpl<_$AuthorImpl>(this, _$identity); @override Map toJson() { @@ -847,32 +871,31 @@ class _$AuthorImpl implements _Author { abstract class _Author implements Author { const factory _Author( - {@JsonKey(name: "author_slug") required final String authorSlug, - @JsonKey(name: "author_name") required final String authorName, - @JsonKey(name: "author_profile_icon") required final String authorProfileIcon, - @JsonKey(name: "author_is_me") required final bool authorIsMe}) = _$AuthorImpl; + {@JsonKey(name: "author_slug") required final String authorSlug, + @JsonKey(name: "author_name") required final String authorName, + @JsonKey(name: "author_profile_icon") + required final String authorProfileIcon, + @JsonKey(name: "author_is_me") required final bool authorIsMe}) = + _$AuthorImpl; factory _Author.fromJson(Map json) = _$AuthorImpl.fromJson; @override @JsonKey(name: "author_slug") String get authorSlug; - @override @JsonKey(name: "author_name") String get authorName; - @override @JsonKey(name: "author_profile_icon") String get authorProfileIcon; - @override @JsonKey(name: "author_is_me") bool get authorIsMe; - @override @JsonKey(ignore: true) - _$$AuthorImplCopyWith<_$AuthorImpl> get copyWith => throw _privateConstructorUsedError; + _$$AuthorImplCopyWith<_$AuthorImpl> get copyWith => + throw _privateConstructorUsedError; } DailySchedule _$DailyScheduleFromJson(Map json) { @@ -883,26 +906,24 @@ DailySchedule _$DailyScheduleFromJson(Map json) { mixin _$DailySchedule { @JsonKey(name: "name") String get name => throw _privateConstructorUsedError; - @JsonKey(name: "uniq") String get uniq => throw _privateConstructorUsedError; - @JsonKey(name: "portion") Portion get portion => throw _privateConstructorUsedError; - @JsonKey(name: "quantity") int get quantity => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $DailyScheduleCopyWith get copyWith => throw _privateConstructorUsedError; + $DailyScheduleCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $DailyScheduleCopyWith<$Res> { - factory $DailyScheduleCopyWith(DailySchedule value, $Res Function(DailySchedule) then) = _$DailyScheduleCopyWithImpl<$Res, DailySchedule>; - + factory $DailyScheduleCopyWith( + DailySchedule value, $Res Function(DailySchedule) then) = + _$DailyScheduleCopyWithImpl<$Res, DailySchedule>; @useResult $Res call( {@JsonKey(name: "name") String name, @@ -912,12 +933,12 @@ abstract class $DailyScheduleCopyWith<$Res> { } /// @nodoc -class _$DailyScheduleCopyWithImpl<$Res, $Val extends DailySchedule> implements $DailyScheduleCopyWith<$Res> { +class _$DailyScheduleCopyWithImpl<$Res, $Val extends DailySchedule> + implements $DailyScheduleCopyWith<$Res> { _$DailyScheduleCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -951,9 +972,11 @@ class _$DailyScheduleCopyWithImpl<$Res, $Val extends DailySchedule> implements $ } /// @nodoc -abstract class _$$DailyScheduleImplCopyWith<$Res> implements $DailyScheduleCopyWith<$Res> { - factory _$$DailyScheduleImplCopyWith(_$DailyScheduleImpl value, $Res Function(_$DailyScheduleImpl) then) = __$$DailyScheduleImplCopyWithImpl<$Res>; - +abstract class _$$DailyScheduleImplCopyWith<$Res> + implements $DailyScheduleCopyWith<$Res> { + factory _$$DailyScheduleImplCopyWith( + _$DailyScheduleImpl value, $Res Function(_$DailyScheduleImpl) then) = + __$$DailyScheduleImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -964,8 +987,12 @@ abstract class _$$DailyScheduleImplCopyWith<$Res> implements $DailyScheduleCopyW } /// @nodoc -class __$$DailyScheduleImplCopyWithImpl<$Res> extends _$DailyScheduleCopyWithImpl<$Res, _$DailyScheduleImpl> implements _$$DailyScheduleImplCopyWith<$Res> { - __$$DailyScheduleImplCopyWithImpl(_$DailyScheduleImpl _value, $Res Function(_$DailyScheduleImpl) _then) : super(_value, _then); +class __$$DailyScheduleImplCopyWithImpl<$Res> + extends _$DailyScheduleCopyWithImpl<$Res, _$DailyScheduleImpl> + implements _$$DailyScheduleImplCopyWith<$Res> { + __$$DailyScheduleImplCopyWithImpl( + _$DailyScheduleImpl _value, $Res Function(_$DailyScheduleImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -1005,7 +1032,8 @@ class _$DailyScheduleImpl implements _DailySchedule { @JsonKey(name: "portion") required this.portion, @JsonKey(name: "quantity") required this.quantity}); - factory _$DailyScheduleImpl.fromJson(Map json) => _$$DailyScheduleImplFromJson(json); + factory _$DailyScheduleImpl.fromJson(Map json) => + _$$DailyScheduleImplFromJson(json); @override @JsonKey(name: "name") @@ -1033,7 +1061,8 @@ class _$DailyScheduleImpl implements _DailySchedule { (identical(other.name, name) || other.name == name) && (identical(other.uniq, uniq) || other.uniq == uniq) && (identical(other.portion, portion) || other.portion == portion) && - (identical(other.quantity, quantity) || other.quantity == quantity)); + (identical(other.quantity, quantity) || + other.quantity == quantity)); } @JsonKey(ignore: true) @@ -1043,7 +1072,8 @@ class _$DailyScheduleImpl implements _DailySchedule { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$DailyScheduleImplCopyWith<_$DailyScheduleImpl> get copyWith => __$$DailyScheduleImplCopyWithImpl<_$DailyScheduleImpl>(this, _$identity); + _$$DailyScheduleImplCopyWith<_$DailyScheduleImpl> get copyWith => + __$$DailyScheduleImplCopyWithImpl<_$DailyScheduleImpl>(this, _$identity); @override Map toJson() { @@ -1055,32 +1085,31 @@ class _$DailyScheduleImpl implements _DailySchedule { abstract class _DailySchedule implements DailySchedule { const factory _DailySchedule( - {@JsonKey(name: "name") required final String name, - @JsonKey(name: "uniq") required final String uniq, - @JsonKey(name: "portion") required final Portion portion, - @JsonKey(name: "quantity") required final int quantity}) = _$DailyScheduleImpl; + {@JsonKey(name: "name") required final String name, + @JsonKey(name: "uniq") required final String uniq, + @JsonKey(name: "portion") required final Portion portion, + @JsonKey(name: "quantity") required final int quantity}) = + _$DailyScheduleImpl; - factory _DailySchedule.fromJson(Map json) = _$DailyScheduleImpl.fromJson; + factory _DailySchedule.fromJson(Map json) = + _$DailyScheduleImpl.fromJson; @override @JsonKey(name: "name") String get name; - @override @JsonKey(name: "uniq") String get uniq; - @override @JsonKey(name: "portion") Portion get portion; - @override @JsonKey(name: "quantity") int get quantity; - @override @JsonKey(ignore: true) - _$$DailyScheduleImplCopyWith<_$DailyScheduleImpl> get copyWith => throw _privateConstructorUsedError; + _$$DailyScheduleImplCopyWith<_$DailyScheduleImpl> get copyWith => + throw _privateConstructorUsedError; } Type _$TypeFromJson(Map json) { @@ -1091,37 +1120,37 @@ Type _$TypeFromJson(Map json) { mixin _$Type { @JsonKey(name: "alko") bool? get alko => throw _privateConstructorUsedError; - @JsonKey(name: "veg") bool? get veg => throw _privateConstructorUsedError; - @JsonKey(name: "corb") bool? get corb => throw _privateConstructorUsedError; - @JsonKey(name: "meat") bool? get meat => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) $TypeCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $TypeCopyWith<$Res> { - factory $TypeCopyWith(Type value, $Res Function(Type) then) = _$TypeCopyWithImpl<$Res, Type>; - + factory $TypeCopyWith(Type value, $Res Function(Type) then) = + _$TypeCopyWithImpl<$Res, Type>; @useResult - $Res call({@JsonKey(name: "alko") bool? alko, @JsonKey(name: "veg") bool? veg, @JsonKey(name: "corb") bool? corb, @JsonKey(name: "meat") bool? meat}); + $Res call( + {@JsonKey(name: "alko") bool? alko, + @JsonKey(name: "veg") bool? veg, + @JsonKey(name: "corb") bool? corb, + @JsonKey(name: "meat") bool? meat}); } /// @nodoc -class _$TypeCopyWithImpl<$Res, $Val extends Type> implements $TypeCopyWith<$Res> { +class _$TypeCopyWithImpl<$Res, $Val extends Type> + implements $TypeCopyWith<$Res> { _$TypeCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -1156,16 +1185,24 @@ class _$TypeCopyWithImpl<$Res, $Val extends Type> implements $TypeCopyWith<$Res> /// @nodoc abstract class _$$TypeImplCopyWith<$Res> implements $TypeCopyWith<$Res> { - factory _$$TypeImplCopyWith(_$TypeImpl value, $Res Function(_$TypeImpl) then) = __$$TypeImplCopyWithImpl<$Res>; - + factory _$$TypeImplCopyWith( + _$TypeImpl value, $Res Function(_$TypeImpl) then) = + __$$TypeImplCopyWithImpl<$Res>; @override @useResult - $Res call({@JsonKey(name: "alko") bool? alko, @JsonKey(name: "veg") bool? veg, @JsonKey(name: "corb") bool? corb, @JsonKey(name: "meat") bool? meat}); + $Res call( + {@JsonKey(name: "alko") bool? alko, + @JsonKey(name: "veg") bool? veg, + @JsonKey(name: "corb") bool? corb, + @JsonKey(name: "meat") bool? meat}); } /// @nodoc -class __$$TypeImplCopyWithImpl<$Res> extends _$TypeCopyWithImpl<$Res, _$TypeImpl> implements _$$TypeImplCopyWith<$Res> { - __$$TypeImplCopyWithImpl(_$TypeImpl _value, $Res Function(_$TypeImpl) _then) : super(_value, _then); +class __$$TypeImplCopyWithImpl<$Res> + extends _$TypeCopyWithImpl<$Res, _$TypeImpl> + implements _$$TypeImplCopyWith<$Res> { + __$$TypeImplCopyWithImpl(_$TypeImpl _value, $Res Function(_$TypeImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -1199,9 +1236,14 @@ class __$$TypeImplCopyWithImpl<$Res> extends _$TypeCopyWithImpl<$Res, _$TypeImpl /// @nodoc @JsonSerializable() class _$TypeImpl implements _Type { - const _$TypeImpl({@JsonKey(name: "alko") this.alko, @JsonKey(name: "veg") this.veg, @JsonKey(name: "corb") this.corb, @JsonKey(name: "meat") this.meat}); + const _$TypeImpl( + {@JsonKey(name: "alko") this.alko, + @JsonKey(name: "veg") this.veg, + @JsonKey(name: "corb") this.corb, + @JsonKey(name: "meat") this.meat}); - factory _$TypeImpl.fromJson(Map json) => _$$TypeImplFromJson(json); + factory _$TypeImpl.fromJson(Map json) => + _$$TypeImplFromJson(json); @override @JsonKey(name: "alko") @@ -1239,7 +1281,8 @@ class _$TypeImpl implements _Type { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$TypeImplCopyWith<_$TypeImpl> get copyWith => __$$TypeImplCopyWithImpl<_$TypeImpl>(this, _$identity); + _$$TypeImplCopyWith<_$TypeImpl> get copyWith => + __$$TypeImplCopyWithImpl<_$TypeImpl>(this, _$identity); @override Map toJson() { @@ -1261,22 +1304,19 @@ abstract class _Type implements Type { @override @JsonKey(name: "alko") bool? get alko; - @override @JsonKey(name: "veg") bool? get veg; - @override @JsonKey(name: "corb") bool? get corb; - @override @JsonKey(name: "meat") bool? get meat; - @override @JsonKey(ignore: true) - _$$TypeImplCopyWith<_$TypeImpl> get copyWith => throw _privateConstructorUsedError; + _$$TypeImplCopyWith<_$TypeImpl> get copyWith => + throw _privateConstructorUsedError; } Links _$LinksFromJson(Map json) { @@ -1287,38 +1327,37 @@ Links _$LinksFromJson(Map json) { mixin _$Links { @JsonKey(name: "first") String get first => throw _privateConstructorUsedError; - @JsonKey(name: "last") String get last => throw _privateConstructorUsedError; - @JsonKey(name: "prev") dynamic get prev => throw _privateConstructorUsedError; - @JsonKey(name: "next") dynamic get next => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) $LinksCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $LinksCopyWith<$Res> { - factory $LinksCopyWith(Links value, $Res Function(Links) then) = _$LinksCopyWithImpl<$Res, Links>; - + factory $LinksCopyWith(Links value, $Res Function(Links) then) = + _$LinksCopyWithImpl<$Res, Links>; @useResult $Res call( - {@JsonKey(name: "first") String first, @JsonKey(name: "last") String last, @JsonKey(name: "prev") dynamic prev, @JsonKey(name: "next") dynamic next}); + {@JsonKey(name: "first") String first, + @JsonKey(name: "last") String last, + @JsonKey(name: "prev") dynamic prev, + @JsonKey(name: "next") dynamic next}); } /// @nodoc -class _$LinksCopyWithImpl<$Res, $Val extends Links> implements $LinksCopyWith<$Res> { +class _$LinksCopyWithImpl<$Res, $Val extends Links> + implements $LinksCopyWith<$Res> { _$LinksCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -1353,17 +1392,25 @@ class _$LinksCopyWithImpl<$Res, $Val extends Links> implements $LinksCopyWith<$R /// @nodoc abstract class _$$LinksImplCopyWith<$Res> implements $LinksCopyWith<$Res> { - factory _$$LinksImplCopyWith(_$LinksImpl value, $Res Function(_$LinksImpl) then) = __$$LinksImplCopyWithImpl<$Res>; - + factory _$$LinksImplCopyWith( + _$LinksImpl value, $Res Function(_$LinksImpl) then) = + __$$LinksImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(name: "first") String first, @JsonKey(name: "last") String last, @JsonKey(name: "prev") dynamic prev, @JsonKey(name: "next") dynamic next}); + {@JsonKey(name: "first") String first, + @JsonKey(name: "last") String last, + @JsonKey(name: "prev") dynamic prev, + @JsonKey(name: "next") dynamic next}); } /// @nodoc -class __$$LinksImplCopyWithImpl<$Res> extends _$LinksCopyWithImpl<$Res, _$LinksImpl> implements _$$LinksImplCopyWith<$Res> { - __$$LinksImplCopyWithImpl(_$LinksImpl _value, $Res Function(_$LinksImpl) _then) : super(_value, _then); +class __$$LinksImplCopyWithImpl<$Res> + extends _$LinksCopyWithImpl<$Res, _$LinksImpl> + implements _$$LinksImplCopyWith<$Res> { + __$$LinksImplCopyWithImpl( + _$LinksImpl _value, $Res Function(_$LinksImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -1403,7 +1450,8 @@ class _$LinksImpl implements _Links { @JsonKey(name: "prev") required this.prev, @JsonKey(name: "next") required this.next}); - factory _$LinksImpl.fromJson(Map json) => _$$LinksImplFromJson(json); + factory _$LinksImpl.fromJson(Map json) => + _$$LinksImplFromJson(json); @override @JsonKey(name: "first") @@ -1436,12 +1484,18 @@ class _$LinksImpl implements _Links { @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, first, last, const DeepCollectionEquality().hash(prev), const DeepCollectionEquality().hash(next)); + int get hashCode => Object.hash( + runtimeType, + first, + last, + const DeepCollectionEquality().hash(prev), + const DeepCollectionEquality().hash(next)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$LinksImplCopyWith<_$LinksImpl> get copyWith => __$$LinksImplCopyWithImpl<_$LinksImpl>(this, _$identity); + _$$LinksImplCopyWith<_$LinksImpl> get copyWith => + __$$LinksImplCopyWithImpl<_$LinksImpl>(this, _$identity); @override Map toJson() { @@ -1463,22 +1517,19 @@ abstract class _Links implements Links { @override @JsonKey(name: "first") String get first; - @override @JsonKey(name: "last") String get last; - @override @JsonKey(name: "prev") dynamic get prev; - @override @JsonKey(name: "next") dynamic get next; - @override @JsonKey(ignore: true) - _$$LinksImplCopyWith<_$LinksImpl> get copyWith => throw _privateConstructorUsedError; + _$$LinksImplCopyWith<_$LinksImpl> get copyWith => + throw _privateConstructorUsedError; } Meta _$MetaFromJson(Map json) { @@ -1489,38 +1540,30 @@ Meta _$MetaFromJson(Map json) { mixin _$Meta { @JsonKey(name: "current_page") int get currentPage => throw _privateConstructorUsedError; - @JsonKey(name: "from") int get from => throw _privateConstructorUsedError; - @JsonKey(name: "last_page") int get lastPage => throw _privateConstructorUsedError; - @JsonKey(name: "links") List get links => throw _privateConstructorUsedError; - @JsonKey(name: "path") String get path => throw _privateConstructorUsedError; - @JsonKey(name: "per_page") int get perPage => throw _privateConstructorUsedError; - @JsonKey(name: "to") int get to => throw _privateConstructorUsedError; - @JsonKey(name: "total") int get total => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) $MetaCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $MetaCopyWith<$Res> { - factory $MetaCopyWith(Meta value, $Res Function(Meta) then) = _$MetaCopyWithImpl<$Res, Meta>; - + factory $MetaCopyWith(Meta value, $Res Function(Meta) then) = + _$MetaCopyWithImpl<$Res, Meta>; @useResult $Res call( {@JsonKey(name: "current_page") int currentPage, @@ -1534,12 +1577,12 @@ abstract class $MetaCopyWith<$Res> { } /// @nodoc -class _$MetaCopyWithImpl<$Res, $Val extends Meta> implements $MetaCopyWith<$Res> { +class _$MetaCopyWithImpl<$Res, $Val extends Meta> + implements $MetaCopyWith<$Res> { _$MetaCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -1594,8 +1637,9 @@ class _$MetaCopyWithImpl<$Res, $Val extends Meta> implements $MetaCopyWith<$Res> /// @nodoc abstract class _$$MetaImplCopyWith<$Res> implements $MetaCopyWith<$Res> { - factory _$$MetaImplCopyWith(_$MetaImpl value, $Res Function(_$MetaImpl) then) = __$$MetaImplCopyWithImpl<$Res>; - + factory _$$MetaImplCopyWith( + _$MetaImpl value, $Res Function(_$MetaImpl) then) = + __$$MetaImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -1610,8 +1654,11 @@ abstract class _$$MetaImplCopyWith<$Res> implements $MetaCopyWith<$Res> { } /// @nodoc -class __$$MetaImplCopyWithImpl<$Res> extends _$MetaCopyWithImpl<$Res, _$MetaImpl> implements _$$MetaImplCopyWith<$Res> { - __$$MetaImplCopyWithImpl(_$MetaImpl _value, $Res Function(_$MetaImpl) _then) : super(_value, _then); +class __$$MetaImplCopyWithImpl<$Res> + extends _$MetaCopyWithImpl<$Res, _$MetaImpl> + implements _$$MetaImplCopyWith<$Res> { + __$$MetaImplCopyWithImpl(_$MetaImpl _value, $Res Function(_$MetaImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -1676,7 +1723,8 @@ class _$MetaImpl implements _Meta { @JsonKey(name: "total") required this.total}) : _links = links; - factory _$MetaImpl.fromJson(Map json) => _$$MetaImplFromJson(json); + factory _$MetaImpl.fromJson(Map json) => + _$$MetaImplFromJson(json); @override @JsonKey(name: "current_page") @@ -1688,7 +1736,6 @@ class _$MetaImpl implements _Meta { @JsonKey(name: "last_page") final int lastPage; final List _links; - @override @JsonKey(name: "links") List get links { @@ -1720,9 +1767,11 @@ class _$MetaImpl implements _Meta { return identical(this, other) || (other.runtimeType == runtimeType && other is _$MetaImpl && - (identical(other.currentPage, currentPage) || other.currentPage == currentPage) && + (identical(other.currentPage, currentPage) || + other.currentPage == currentPage) && (identical(other.from, from) || other.from == from) && - (identical(other.lastPage, lastPage) || other.lastPage == lastPage) && + (identical(other.lastPage, lastPage) || + other.lastPage == lastPage) && const DeepCollectionEquality().equals(other._links, _links) && (identical(other.path, path) || other.path == path) && (identical(other.perPage, perPage) || other.perPage == perPage) && @@ -1732,12 +1781,14 @@ class _$MetaImpl implements _Meta { @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, currentPage, from, lastPage, const DeepCollectionEquality().hash(_links), path, perPage, to, total); + int get hashCode => Object.hash(runtimeType, currentPage, from, lastPage, + const DeepCollectionEquality().hash(_links), path, perPage, to, total); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$MetaImplCopyWith<_$MetaImpl> get copyWith => __$$MetaImplCopyWithImpl<_$MetaImpl>(this, _$identity); + _$$MetaImplCopyWith<_$MetaImpl> get copyWith => + __$$MetaImplCopyWithImpl<_$MetaImpl>(this, _$identity); @override Map toJson() { @@ -1763,38 +1814,31 @@ abstract class _Meta implements Meta { @override @JsonKey(name: "current_page") int get currentPage; - @override @JsonKey(name: "from") int get from; - @override @JsonKey(name: "last_page") int get lastPage; - @override @JsonKey(name: "links") List get links; - @override @JsonKey(name: "path") String get path; - @override @JsonKey(name: "per_page") int get perPage; - @override @JsonKey(name: "to") int get to; - @override @JsonKey(name: "total") int get total; - @override @JsonKey(ignore: true) - _$$MetaImplCopyWith<_$MetaImpl> get copyWith => throw _privateConstructorUsedError; + _$$MetaImplCopyWith<_$MetaImpl> get copyWith => + throw _privateConstructorUsedError; } Link _$LinkFromJson(Map json) { @@ -1805,34 +1849,34 @@ Link _$LinkFromJson(Map json) { mixin _$Link { @JsonKey(name: "url") String? get url => throw _privateConstructorUsedError; - @JsonKey(name: "label") String get label => throw _privateConstructorUsedError; - @JsonKey(name: "active") bool get active => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) $LinkCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $LinkCopyWith<$Res> { - factory $LinkCopyWith(Link value, $Res Function(Link) then) = _$LinkCopyWithImpl<$Res, Link>; - + factory $LinkCopyWith(Link value, $Res Function(Link) then) = + _$LinkCopyWithImpl<$Res, Link>; @useResult - $Res call({@JsonKey(name: "url") String? url, @JsonKey(name: "label") String label, @JsonKey(name: "active") bool active}); + $Res call( + {@JsonKey(name: "url") String? url, + @JsonKey(name: "label") String label, + @JsonKey(name: "active") bool active}); } /// @nodoc -class _$LinkCopyWithImpl<$Res, $Val extends Link> implements $LinkCopyWith<$Res> { +class _$LinkCopyWithImpl<$Res, $Val extends Link> + implements $LinkCopyWith<$Res> { _$LinkCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -1862,16 +1906,23 @@ class _$LinkCopyWithImpl<$Res, $Val extends Link> implements $LinkCopyWith<$Res> /// @nodoc abstract class _$$LinkImplCopyWith<$Res> implements $LinkCopyWith<$Res> { - factory _$$LinkImplCopyWith(_$LinkImpl value, $Res Function(_$LinkImpl) then) = __$$LinkImplCopyWithImpl<$Res>; - + factory _$$LinkImplCopyWith( + _$LinkImpl value, $Res Function(_$LinkImpl) then) = + __$$LinkImplCopyWithImpl<$Res>; @override @useResult - $Res call({@JsonKey(name: "url") String? url, @JsonKey(name: "label") String label, @JsonKey(name: "active") bool active}); + $Res call( + {@JsonKey(name: "url") String? url, + @JsonKey(name: "label") String label, + @JsonKey(name: "active") bool active}); } /// @nodoc -class __$$LinkImplCopyWithImpl<$Res> extends _$LinkCopyWithImpl<$Res, _$LinkImpl> implements _$$LinkImplCopyWith<$Res> { - __$$LinkImplCopyWithImpl(_$LinkImpl _value, $Res Function(_$LinkImpl) _then) : super(_value, _then); +class __$$LinkImplCopyWithImpl<$Res> + extends _$LinkCopyWithImpl<$Res, _$LinkImpl> + implements _$$LinkImplCopyWith<$Res> { + __$$LinkImplCopyWithImpl(_$LinkImpl _value, $Res Function(_$LinkImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -1900,9 +1951,13 @@ class __$$LinkImplCopyWithImpl<$Res> extends _$LinkCopyWithImpl<$Res, _$LinkImpl /// @nodoc @JsonSerializable() class _$LinkImpl implements _Link { - const _$LinkImpl({@JsonKey(name: "url") required this.url, @JsonKey(name: "label") required this.label, @JsonKey(name: "active") required this.active}); + const _$LinkImpl( + {@JsonKey(name: "url") required this.url, + @JsonKey(name: "label") required this.label, + @JsonKey(name: "active") required this.active}); - factory _$LinkImpl.fromJson(Map json) => _$$LinkImplFromJson(json); + factory _$LinkImpl.fromJson(Map json) => + _$$LinkImplFromJson(json); @override @JsonKey(name: "url") @@ -1936,7 +1991,8 @@ class _$LinkImpl implements _Link { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$LinkImplCopyWith<_$LinkImpl> get copyWith => __$$LinkImplCopyWithImpl<_$LinkImpl>(this, _$identity); + _$$LinkImplCopyWith<_$LinkImpl> get copyWith => + __$$LinkImplCopyWithImpl<_$LinkImpl>(this, _$identity); @override Map toJson() { @@ -1957,16 +2013,14 @@ abstract class _Link implements Link { @override @JsonKey(name: "url") String? get url; - @override @JsonKey(name: "label") String get label; - @override @JsonKey(name: "active") bool get active; - @override @JsonKey(ignore: true) - _$$LinkImplCopyWith<_$LinkImpl> get copyWith => throw _privateConstructorUsedError; + _$$LinkImplCopyWith<_$LinkImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/feed/models/diets_pagination_model.g.dart b/lib/features/feed/models/diets_pagination_model.g.dart index ac11372f..0a745095 100644 --- a/lib/features/feed/models/diets_pagination_model.g.dart +++ b/lib/features/feed/models/diets_pagination_model.g.dart @@ -6,13 +6,19 @@ part of 'diets_pagination_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$DietsPaginationImpl _$$DietsPaginationImplFromJson(Map json) => _$DietsPaginationImpl( - data: (json['data'] as List).map((e) => Datum.fromJson(e as Map)).toList(), +_$DietsPaginationImpl _$$DietsPaginationImplFromJson( + Map json) => + _$DietsPaginationImpl( + data: (json['data'] as List) + .map((e) => Datum.fromJson(e as Map)) + .toList(), links: Links.fromJson(json['links'] as Map), meta: Meta.fromJson(json['meta'] as Map), ); -Map _$$DietsPaginationImplToJson(_$DietsPaginationImpl instance) => { +Map _$$DietsPaginationImplToJson( + _$DietsPaginationImpl instance) => + { 'data': instance.data, 'links': instance.links, 'meta': instance.meta, @@ -27,7 +33,11 @@ _$DatumImpl _$$DatumImplFromJson(Map json) => _$DatumImpl( type: Type.fromJson(json['type'] as Map), details: json['details'] as String, dailySchedule: (json['daily_schedule'] as List) - .map((e) => (e as List).map((e) => (e as List).map((e) => DailySchedule.fromJson(e as Map)).toList()).toList()) + .map((e) => (e as List) + .map((e) => (e as List) + .map((e) => DailySchedule.fromJson(e as Map)) + .toList()) + .toList()) .toList(), author: Author.fromJson(json['author'] as Map), totalLikes: (json['total_likes'] as num).toInt(), @@ -35,7 +45,8 @@ _$DatumImpl _$$DatumImplFromJson(Map json) => _$DatumImpl( totalComments: (json['total_comments'] as num).toInt(), ); -Map _$$DatumImplToJson(_$DatumImpl instance) => { +Map _$$DatumImplToJson(_$DatumImpl instance) => + { 'id': instance.id, 'name': instance.name, 'image': instance.image, @@ -57,21 +68,24 @@ _$AuthorImpl _$$AuthorImplFromJson(Map json) => _$AuthorImpl( authorIsMe: json['author_is_me'] as bool, ); -Map _$$AuthorImplToJson(_$AuthorImpl instance) => { +Map _$$AuthorImplToJson(_$AuthorImpl instance) => + { 'author_slug': instance.authorSlug, 'author_name': instance.authorName, 'author_profile_icon': instance.authorProfileIcon, 'author_is_me': instance.authorIsMe, }; -_$DailyScheduleImpl _$$DailyScheduleImplFromJson(Map json) => _$DailyScheduleImpl( +_$DailyScheduleImpl _$$DailyScheduleImplFromJson(Map json) => + _$DailyScheduleImpl( name: json['name'] as String, uniq: json['uniq'] as String, portion: $enumDecode(_$PortionEnumMap, json['portion']), quantity: (json['quantity'] as num).toInt(), ); -Map _$$DailyScheduleImplToJson(_$DailyScheduleImpl instance) => { +Map _$$DailyScheduleImplToJson(_$DailyScheduleImpl instance) => + { 'name': instance.name, 'uniq': instance.uniq, 'portion': _$PortionEnumMap[instance.portion]!, @@ -91,7 +105,8 @@ _$TypeImpl _$$TypeImplFromJson(Map json) => _$TypeImpl( meat: json['meat'] as bool?, ); -Map _$$TypeImplToJson(_$TypeImpl instance) => { +Map _$$TypeImplToJson(_$TypeImpl instance) => + { 'alko': instance.alko, 'veg': instance.veg, 'corb': instance.corb, @@ -105,7 +120,8 @@ _$LinksImpl _$$LinksImplFromJson(Map json) => _$LinksImpl( next: json['next'], ); -Map _$$LinksImplToJson(_$LinksImpl instance) => { +Map _$$LinksImplToJson(_$LinksImpl instance) => + { 'first': instance.first, 'last': instance.last, 'prev': instance.prev, @@ -116,14 +132,17 @@ _$MetaImpl _$$MetaImplFromJson(Map json) => _$MetaImpl( currentPage: (json['current_page'] as num).toInt(), from: (json['from'] as num).toInt(), lastPage: (json['last_page'] as num).toInt(), - links: (json['links'] as List).map((e) => Link.fromJson(e as Map)).toList(), + links: (json['links'] as List) + .map((e) => Link.fromJson(e as Map)) + .toList(), path: json['path'] as String, perPage: (json['per_page'] as num).toInt(), to: (json['to'] as num).toInt(), total: (json['total'] as num).toInt(), ); -Map _$$MetaImplToJson(_$MetaImpl instance) => { +Map _$$MetaImplToJson(_$MetaImpl instance) => + { 'current_page': instance.currentPage, 'from': instance.from, 'last_page': instance.lastPage, @@ -140,7 +159,8 @@ _$LinkImpl _$$LinkImplFromJson(Map json) => _$LinkImpl( active: json['active'] as bool, ); -Map _$$LinkImplToJson(_$LinkImpl instance) => { +Map _$$LinkImplToJson(_$LinkImpl instance) => + { 'url': instance.url, 'label': instance.label, 'active': instance.active, diff --git a/lib/features/feed/models/feed_blog_post_settings_model.dart b/lib/features/feed/models/feed_blog_post_settings_model.dart index 8296a8be..66e0ecf3 100644 --- a/lib/features/feed/models/feed_blog_post_settings_model.dart +++ b/lib/features/feed/models/feed_blog_post_settings_model.dart @@ -1,3 +1,4 @@ +import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart'; import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; @@ -8,6 +9,7 @@ part 'feed_blog_post_settings_model.g.dart'; class FeedBlogPostSettingsModel with _$FeedBlogPostSettingsModel { const factory FeedBlogPostSettingsModel({ @JsonKey(name: 'data') required List feedBlogPostList, + required Meta meta, }) = _FeedBlogPostSettingsModel; factory FeedBlogPostSettingsModel.fromJson(Map json) => _$FeedBlogPostSettingsModelFromJson(json); diff --git a/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart b/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart index 7fd8a12e..c680d82e 100644 --- a/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart +++ b/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart @@ -24,6 +24,7 @@ mixin _$FeedBlogPostSettingsModel { @JsonKey(name: 'data') List get feedBlogPostList => throw _privateConstructorUsedError; + Meta get meta => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -37,7 +38,11 @@ abstract class $FeedBlogPostSettingsModelCopyWith<$Res> { $Res Function(FeedBlogPostSettingsModel) then) = _$FeedBlogPostSettingsModelCopyWithImpl<$Res, FeedBlogPostSettingsModel>; @useResult - $Res call({@JsonKey(name: 'data') List feedBlogPostList}); + $Res call( + {@JsonKey(name: 'data') List feedBlogPostList, + Meta meta}); + + $MetaCopyWith<$Res> get meta; } /// @nodoc @@ -55,14 +60,27 @@ class _$FeedBlogPostSettingsModelCopyWithImpl<$Res, @override $Res call({ Object? feedBlogPostList = null, + Object? meta = null, }) { return _then(_value.copyWith( feedBlogPostList: null == feedBlogPostList ? _value.feedBlogPostList : feedBlogPostList // ignore: cast_nullable_to_non_nullable as List, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, ) as $Val); } + + @override + @pragma('vm:prefer-inline') + $MetaCopyWith<$Res> get meta { + return $MetaCopyWith<$Res>(_value.meta, (value) { + return _then(_value.copyWith(meta: value) as $Val); + }); + } } /// @nodoc @@ -74,7 +92,12 @@ abstract class _$$FeedBlogPostSettingsModelImplCopyWith<$Res> __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({@JsonKey(name: 'data') List feedBlogPostList}); + $Res call( + {@JsonKey(name: 'data') List feedBlogPostList, + Meta meta}); + + @override + $MetaCopyWith<$Res> get meta; } /// @nodoc @@ -91,12 +114,17 @@ class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res> @override $Res call({ Object? feedBlogPostList = null, + Object? meta = null, }) { return _then(_$FeedBlogPostSettingsModelImpl( feedBlogPostList: null == feedBlogPostList ? _value._feedBlogPostList : feedBlogPostList // ignore: cast_nullable_to_non_nullable as List, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, )); } } @@ -106,7 +134,8 @@ class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res> class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { const _$FeedBlogPostSettingsModelImpl( {@JsonKey(name: 'data') - required final List feedBlogPostList}) + required final List feedBlogPostList, + required this.meta}) : _feedBlogPostList = feedBlogPostList; factory _$FeedBlogPostSettingsModelImpl.fromJson(Map json) => @@ -122,9 +151,12 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { return EqualUnmodifiableListView(_feedBlogPostList); } + @override + final Meta meta; + @override String toString() { - return 'FeedBlogPostSettingsModel(feedBlogPostList: $feedBlogPostList)'; + return 'FeedBlogPostSettingsModel(feedBlogPostList: $feedBlogPostList, meta: $meta)'; } @override @@ -133,13 +165,14 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { (other.runtimeType == runtimeType && other is _$FeedBlogPostSettingsModelImpl && const DeepCollectionEquality() - .equals(other._feedBlogPostList, _feedBlogPostList)); + .equals(other._feedBlogPostList, _feedBlogPostList) && + (identical(other.meta, meta) || other.meta == meta)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, const DeepCollectionEquality().hash(_feedBlogPostList)); + int get hashCode => Object.hash(runtimeType, + const DeepCollectionEquality().hash(_feedBlogPostList), meta); @JsonKey(ignore: true) @override @@ -158,9 +191,9 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { abstract class _FeedBlogPostSettingsModel implements FeedBlogPostSettingsModel { const factory _FeedBlogPostSettingsModel( - {@JsonKey(name: 'data') - required final List feedBlogPostList}) = - _$FeedBlogPostSettingsModelImpl; + {@JsonKey(name: 'data') + required final List feedBlogPostList, + required final Meta meta}) = _$FeedBlogPostSettingsModelImpl; factory _FeedBlogPostSettingsModel.fromJson(Map json) = _$FeedBlogPostSettingsModelImpl.fromJson; @@ -169,6 +202,8 @@ abstract class _FeedBlogPostSettingsModel implements FeedBlogPostSettingsModel { @JsonKey(name: 'data') List get feedBlogPostList; @override + Meta get meta; + @override @JsonKey(ignore: true) _$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl> get copyWith => throw _privateConstructorUsedError; diff --git a/lib/features/feed/models/feed_blog_post_settings_model.g.dart b/lib/features/feed/models/feed_blog_post_settings_model.g.dart index 3f48be1b..e300b594 100644 --- a/lib/features/feed/models/feed_blog_post_settings_model.g.dart +++ b/lib/features/feed/models/feed_blog_post_settings_model.g.dart @@ -12,10 +12,12 @@ _$FeedBlogPostSettingsModelImpl _$$FeedBlogPostSettingsModelImplFromJson( feedBlogPostList: (json['data'] as List) .map((e) => FeedBlogPostModel.fromJson(e as Map)) .toList(), + meta: Meta.fromJson(json['meta'] as Map), ); Map _$$FeedBlogPostSettingsModelImplToJson( _$FeedBlogPostSettingsModelImpl instance) => { 'data': instance.feedBlogPostList, + 'meta': instance.meta, }; diff --git a/lib/features/feed/presentation/bloc/diets_cubit/diets_state.freezed.dart b/lib/features/feed/presentation/bloc/diets_cubit/diets_state.freezed.dart index 84dc0117..adff30f5 100644 --- a/lib/features/feed/presentation/bloc/diets_cubit/diets_state.freezed.dart +++ b/lib/features/feed/presentation/bloc/diets_cubit/diets_state.freezed.dart @@ -24,7 +24,6 @@ mixin _$DietsState { required TResult Function(String errorMessage) error, }) => throw _privateConstructorUsedError; - @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { @@ -71,28 +70,36 @@ mixin _$DietsState { /// @nodoc abstract class $DietsStateCopyWith<$Res> { - factory $DietsStateCopyWith(DietsState value, $Res Function(DietsState) then) = _$DietsStateCopyWithImpl<$Res, DietsState>; + factory $DietsStateCopyWith( + DietsState value, $Res Function(DietsState) then) = + _$DietsStateCopyWithImpl<$Res, DietsState>; } /// @nodoc -class _$DietsStateCopyWithImpl<$Res, $Val extends DietsState> implements $DietsStateCopyWith<$Res> { +class _$DietsStateCopyWithImpl<$Res, $Val extends DietsState> + implements $DietsStateCopyWith<$Res> { _$DietsStateCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; } /// @nodoc abstract class _$$DietsStateImplCopyWith<$Res> { - factory _$$DietsStateImplCopyWith(_$DietsStateImpl value, $Res Function(_$DietsStateImpl) then) = __$$DietsStateImplCopyWithImpl<$Res>; + factory _$$DietsStateImplCopyWith( + _$DietsStateImpl value, $Res Function(_$DietsStateImpl) then) = + __$$DietsStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$DietsStateImplCopyWithImpl<$Res> extends _$DietsStateCopyWithImpl<$Res, _$DietsStateImpl> implements _$$DietsStateImplCopyWith<$Res> { - __$$DietsStateImplCopyWithImpl(_$DietsStateImpl _value, $Res Function(_$DietsStateImpl) _then) : super(_value, _then); +class __$$DietsStateImplCopyWithImpl<$Res> + extends _$DietsStateCopyWithImpl<$Res, _$DietsStateImpl> + implements _$$DietsStateImplCopyWith<$Res> { + __$$DietsStateImplCopyWithImpl( + _$DietsStateImpl _value, $Res Function(_$DietsStateImpl) _then) + : super(_value, _then); } /// @nodoc @@ -107,7 +114,8 @@ class _$DietsStateImpl implements _DietsState { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$DietsStateImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$DietsStateImpl); } @override @@ -194,14 +202,18 @@ abstract class _DietsState implements DietsState { /// @nodoc abstract class _$$DietsStateLoadingImplCopyWith<$Res> { - factory _$$DietsStateLoadingImplCopyWith(_$DietsStateLoadingImpl value, $Res Function(_$DietsStateLoadingImpl) then) = + factory _$$DietsStateLoadingImplCopyWith(_$DietsStateLoadingImpl value, + $Res Function(_$DietsStateLoadingImpl) then) = __$$DietsStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc -class __$$DietsStateLoadingImplCopyWithImpl<$Res> extends _$DietsStateCopyWithImpl<$Res, _$DietsStateLoadingImpl> +class __$$DietsStateLoadingImplCopyWithImpl<$Res> + extends _$DietsStateCopyWithImpl<$Res, _$DietsStateLoadingImpl> implements _$$DietsStateLoadingImplCopyWith<$Res> { - __$$DietsStateLoadingImplCopyWithImpl(_$DietsStateLoadingImpl _value, $Res Function(_$DietsStateLoadingImpl) _then) : super(_value, _then); + __$$DietsStateLoadingImplCopyWithImpl(_$DietsStateLoadingImpl _value, + $Res Function(_$DietsStateLoadingImpl) _then) + : super(_value, _then); } /// @nodoc @@ -216,7 +228,8 @@ class _$DietsStateLoadingImpl implements DietsStateLoading { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$DietsStateLoadingImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$DietsStateLoadingImpl); } @override @@ -303,9 +316,9 @@ abstract class DietsStateLoading implements DietsState { /// @nodoc abstract class _$$DietsStateLoadedImplCopyWith<$Res> { - factory _$$DietsStateLoadedImplCopyWith(_$DietsStateLoadedImpl value, $Res Function(_$DietsStateLoadedImpl) then) = + factory _$$DietsStateLoadedImplCopyWith(_$DietsStateLoadedImpl value, + $Res Function(_$DietsStateLoadedImpl) then) = __$$DietsStateLoadedImplCopyWithImpl<$Res>; - @useResult $Res call({DietsPagination diets}); @@ -313,9 +326,12 @@ abstract class _$$DietsStateLoadedImplCopyWith<$Res> { } /// @nodoc -class __$$DietsStateLoadedImplCopyWithImpl<$Res> extends _$DietsStateCopyWithImpl<$Res, _$DietsStateLoadedImpl> +class __$$DietsStateLoadedImplCopyWithImpl<$Res> + extends _$DietsStateCopyWithImpl<$Res, _$DietsStateLoadedImpl> implements _$$DietsStateLoadedImplCopyWith<$Res> { - __$$DietsStateLoadedImplCopyWithImpl(_$DietsStateLoadedImpl _value, $Res Function(_$DietsStateLoadedImpl) _then) : super(_value, _then); + __$$DietsStateLoadedImplCopyWithImpl(_$DietsStateLoadedImpl _value, + $Res Function(_$DietsStateLoadedImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -355,7 +371,9 @@ class _$DietsStateLoadedImpl implements DietsStateLoaded { @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$DietsStateLoadedImpl && (identical(other.diets, diets) || other.diets == diets)); + (other.runtimeType == runtimeType && + other is _$DietsStateLoadedImpl && + (identical(other.diets, diets) || other.diets == diets)); } @override @@ -364,7 +382,9 @@ class _$DietsStateLoadedImpl implements DietsStateLoaded { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$DietsStateLoadedImplCopyWith<_$DietsStateLoadedImpl> get copyWith => __$$DietsStateLoadedImplCopyWithImpl<_$DietsStateLoadedImpl>(this, _$identity); + _$$DietsStateLoadedImplCopyWith<_$DietsStateLoadedImpl> get copyWith => + __$$DietsStateLoadedImplCopyWithImpl<_$DietsStateLoadedImpl>( + this, _$identity); @override @optionalTypeArgs @@ -442,25 +462,31 @@ class _$DietsStateLoadedImpl implements DietsStateLoaded { } abstract class DietsStateLoaded implements DietsState { - const factory DietsStateLoaded({required final DietsPagination diets}) = _$DietsStateLoadedImpl; + const factory DietsStateLoaded({required final DietsPagination diets}) = + _$DietsStateLoadedImpl; DietsPagination get diets; - @JsonKey(ignore: true) - _$$DietsStateLoadedImplCopyWith<_$DietsStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; + _$$DietsStateLoadedImplCopyWith<_$DietsStateLoadedImpl> get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class _$$DietsStateErrorImplCopyWith<$Res> { - factory _$$DietsStateErrorImplCopyWith(_$DietsStateErrorImpl value, $Res Function(_$DietsStateErrorImpl) then) = __$$DietsStateErrorImplCopyWithImpl<$Res>; - + factory _$$DietsStateErrorImplCopyWith(_$DietsStateErrorImpl value, + $Res Function(_$DietsStateErrorImpl) then) = + __$$DietsStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$DietsStateErrorImplCopyWithImpl<$Res> extends _$DietsStateCopyWithImpl<$Res, _$DietsStateErrorImpl> implements _$$DietsStateErrorImplCopyWith<$Res> { - __$$DietsStateErrorImplCopyWithImpl(_$DietsStateErrorImpl _value, $Res Function(_$DietsStateErrorImpl) _then) : super(_value, _then); +class __$$DietsStateErrorImplCopyWithImpl<$Res> + extends _$DietsStateCopyWithImpl<$Res, _$DietsStateErrorImpl> + implements _$$DietsStateErrorImplCopyWith<$Res> { + __$$DietsStateErrorImplCopyWithImpl( + _$DietsStateErrorImpl _value, $Res Function(_$DietsStateErrorImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -494,7 +520,8 @@ class _$DietsStateErrorImpl implements DietsStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$DietsStateErrorImpl && - (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || + other.errorMessage == errorMessage)); } @override @@ -503,7 +530,9 @@ class _$DietsStateErrorImpl implements DietsStateError { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$DietsStateErrorImplCopyWith<_$DietsStateErrorImpl> get copyWith => __$$DietsStateErrorImplCopyWithImpl<_$DietsStateErrorImpl>(this, _$identity); + _$$DietsStateErrorImplCopyWith<_$DietsStateErrorImpl> get copyWith => + __$$DietsStateErrorImplCopyWithImpl<_$DietsStateErrorImpl>( + this, _$identity); @override @optionalTypeArgs @@ -581,10 +610,11 @@ class _$DietsStateErrorImpl implements DietsStateError { } abstract class DietsStateError implements DietsState { - const factory DietsStateError({required final String errorMessage}) = _$DietsStateErrorImpl; + const factory DietsStateError({required final String errorMessage}) = + _$DietsStateErrorImpl; String get errorMessage; - @JsonKey(ignore: true) - _$$DietsStateErrorImplCopyWith<_$DietsStateErrorImpl> get copyWith => throw _privateConstructorUsedError; + _$$DietsStateErrorImplCopyWith<_$DietsStateErrorImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart b/lib/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart index c052c26b..904282c5 100644 --- a/lib/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart +++ b/lib/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart @@ -4,15 +4,47 @@ import 'package:eatvio_app/features/feed/repositories/feed_repository.dart'; class FeedCubit extends Cubit { final FeedRepository feedRepository; + int currentPage = 1; + final int lastPage = 7; + bool isLoading = false; FeedCubit({required this.feedRepository}) : super(const FeedState.loading()); loadFeedBlogPostList() async { try { - final feedBlogPostList = await feedRepository.getFeedBlogPostList(); - emit(FeedState.loaded(feedBlogPostList: feedBlogPostList)); + final feedBlogPosts = await feedRepository.getFeedBlogPosts(); + emit( + FeedState.loaded( + feedBlogPostList: feedBlogPosts.feedBlogPostList, + isLoading: false, + ), + ); } catch (e) { emit(FeedState.error(errorMessage: e.toString())); } } + + loadNextPage() async { + print('start'); + try { + if (lastPage < currentPage) { + currentPage++; + final feedBlogPosts = await feedRepository.getFeedBlogPosts(page: currentPage); + emit( + FeedState.loaded( + feedBlogPostList: [ + ...(state as FeedStateLoaded).feedBlogPostList, + ...feedBlogPosts.feedBlogPostList, + ], + isLoading: false, + ), + ); + } + } catch (e) { + print('error bro'); + print(e.toString()); + } finally { + print('end'); + } + } } diff --git a/lib/features/feed/presentation/bloc/feed_cubit/feed_state.dart b/lib/features/feed/presentation/bloc/feed_cubit/feed_state.dart index 70e8c3b7..09837dfb 100644 --- a/lib/features/feed/presentation/bloc/feed_cubit/feed_state.dart +++ b/lib/features/feed/presentation/bloc/feed_cubit/feed_state.dart @@ -11,6 +11,7 @@ abstract class FeedState with _$FeedState { const factory FeedState.loaded({ required List feedBlogPostList, + required bool isLoading, }) = FeedStateLoaded; const factory FeedState.error({ diff --git a/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart b/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart index ab3385f3..779dcdb5 100644 --- a/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart +++ b/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart @@ -20,7 +20,9 @@ mixin _$FeedState { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(List feedBlogPostList) loaded, + required TResult Function( + List feedBlogPostList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) => throw _privateConstructorUsedError; @@ -28,7 +30,8 @@ mixin _$FeedState { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(List feedBlogPostList)? loaded, + TResult? Function(List feedBlogPostList, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) => throw _privateConstructorUsedError; @@ -36,7 +39,8 @@ mixin _$FeedState { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(List feedBlogPostList)? loaded, + TResult Function(List feedBlogPostList, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) => @@ -125,7 +129,9 @@ class _$FeedStateImpl implements _FeedState { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(List feedBlogPostList) loaded, + required TResult Function( + List feedBlogPostList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return $default(); @@ -136,7 +142,8 @@ class _$FeedStateImpl implements _FeedState { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(List feedBlogPostList)? loaded, + TResult? Function(List feedBlogPostList, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return $default?.call(); @@ -147,7 +154,8 @@ class _$FeedStateImpl implements _FeedState { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(List feedBlogPostList)? loaded, + TResult Function(List feedBlogPostList, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -239,7 +247,9 @@ class _$FeedStateLoadingImpl implements FeedStateLoading { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(List feedBlogPostList) loaded, + required TResult Function( + List feedBlogPostList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return loading(); @@ -250,7 +260,8 @@ class _$FeedStateLoadingImpl implements FeedStateLoading { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(List feedBlogPostList)? loaded, + TResult? Function(List feedBlogPostList, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return loading?.call(); @@ -261,7 +272,8 @@ class _$FeedStateLoadingImpl implements FeedStateLoading { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(List feedBlogPostList)? loaded, + TResult Function(List feedBlogPostList, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -319,7 +331,7 @@ abstract class _$$FeedStateLoadedImplCopyWith<$Res> { $Res Function(_$FeedStateLoadedImpl) then) = __$$FeedStateLoadedImplCopyWithImpl<$Res>; @useResult - $Res call({List feedBlogPostList}); + $Res call({List feedBlogPostList, bool isLoading}); } /// @nodoc @@ -334,12 +346,17 @@ class __$$FeedStateLoadedImplCopyWithImpl<$Res> @override $Res call({ Object? feedBlogPostList = null, + Object? isLoading = null, }) { return _then(_$FeedStateLoadedImpl( feedBlogPostList: null == feedBlogPostList ? _value._feedBlogPostList : feedBlogPostList // ignore: cast_nullable_to_non_nullable as List, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, )); } } @@ -348,7 +365,8 @@ class __$$FeedStateLoadedImplCopyWithImpl<$Res> class _$FeedStateLoadedImpl implements FeedStateLoaded { const _$FeedStateLoadedImpl( - {required final List feedBlogPostList}) + {required final List feedBlogPostList, + required this.isLoading}) : _feedBlogPostList = feedBlogPostList; final List _feedBlogPostList; @@ -360,9 +378,12 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { return EqualUnmodifiableListView(_feedBlogPostList); } + @override + final bool isLoading; + @override String toString() { - return 'FeedState.loaded(feedBlogPostList: $feedBlogPostList)'; + return 'FeedState.loaded(feedBlogPostList: $feedBlogPostList, isLoading: $isLoading)'; } @override @@ -371,12 +392,14 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { (other.runtimeType == runtimeType && other is _$FeedStateLoadedImpl && const DeepCollectionEquality() - .equals(other._feedBlogPostList, _feedBlogPostList)); + .equals(other._feedBlogPostList, _feedBlogPostList) && + (identical(other.isLoading, isLoading) || + other.isLoading == isLoading)); } @override - int get hashCode => Object.hash( - runtimeType, const DeepCollectionEquality().hash(_feedBlogPostList)); + int get hashCode => Object.hash(runtimeType, + const DeepCollectionEquality().hash(_feedBlogPostList), isLoading); @JsonKey(ignore: true) @override @@ -390,10 +413,12 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(List feedBlogPostList) loaded, + required TResult Function( + List feedBlogPostList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { - return loaded(feedBlogPostList); + return loaded(feedBlogPostList, isLoading); } @override @@ -401,10 +426,11 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(List feedBlogPostList)? loaded, + TResult? Function(List feedBlogPostList, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { - return loaded?.call(feedBlogPostList); + return loaded?.call(feedBlogPostList, isLoading); } @override @@ -412,12 +438,13 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(List feedBlogPostList)? loaded, + TResult Function(List feedBlogPostList, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { if (loaded != null) { - return loaded(feedBlogPostList); + return loaded(feedBlogPostList, isLoading); } return orElse(); } @@ -462,10 +489,11 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { abstract class FeedStateLoaded implements FeedState { const factory FeedStateLoaded( - {required final List feedBlogPostList}) = - _$FeedStateLoadedImpl; + {required final List feedBlogPostList, + required final bool isLoading}) = _$FeedStateLoadedImpl; List get feedBlogPostList; + bool get isLoading; @JsonKey(ignore: true) _$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; @@ -539,7 +567,9 @@ class _$FeedStateErrorImpl implements FeedStateError { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(List feedBlogPostList) loaded, + required TResult Function( + List feedBlogPostList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return error(errorMessage); @@ -550,7 +580,8 @@ class _$FeedStateErrorImpl implements FeedStateError { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(List feedBlogPostList)? loaded, + TResult? Function(List feedBlogPostList, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return error?.call(errorMessage); @@ -561,7 +592,8 @@ class _$FeedStateErrorImpl implements FeedStateError { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(List feedBlogPostList)? loaded, + TResult Function(List feedBlogPostList, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { diff --git a/lib/features/feed/presentation/pages/feed_screen.dart b/lib/features/feed/presentation/pages/feed_screen.dart index ec949667..662c06ec 100644 --- a/lib/features/feed/presentation/pages/feed_screen.dart +++ b/lib/features/feed/presentation/pages/feed_screen.dart @@ -94,6 +94,7 @@ class _FeedScreenState extends State { ); } else if (state is DietsStateError) { return Scaffold( + backgroundColor: Colors.grey.shade200, body: Padding( padding: const EdgeInsets.all(16), child: Center( @@ -103,6 +104,7 @@ class _FeedScreenState extends State { ); } else { return Scaffold( + backgroundColor: Colors.grey.shade200, body: Center( child: CupertinoActivityIndicator(), ), @@ -133,6 +135,7 @@ class _FeedScreenState extends State { ); } else if (state is FeedStateError) { return Scaffold( + backgroundColor: Colors.grey.shade200, body: Padding( padding: const EdgeInsets.all(16), child: Center( @@ -142,6 +145,7 @@ class _FeedScreenState extends State { ); } else { return Scaffold( + backgroundColor: Colors.grey.shade200, body: Center( child: CupertinoActivityIndicator(), ), @@ -172,6 +176,7 @@ class _FeedScreenState extends State { ); } else if (state is RecipesStateError) { return Scaffold( + backgroundColor: Colors.grey.shade200, body: Padding( padding: const EdgeInsets.all(16), child: Center( @@ -181,6 +186,7 @@ class _FeedScreenState extends State { ); } else { return Scaffold( + backgroundColor: Colors.grey.shade200, body: Center( child: CupertinoActivityIndicator(), ), diff --git a/lib/features/feed/presentation/widgets/blog_post_widget.dart b/lib/features/feed/presentation/widgets/blog_post_widget.dart index 7eed8cfc..cea3a496 100644 --- a/lib/features/feed/presentation/widgets/blog_post_widget.dart +++ b/lib/features/feed/presentation/widgets/blog_post_widget.dart @@ -4,6 +4,7 @@ import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart'; import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; import 'package:go_router/go_router.dart'; import 'package:share_plus/share_plus.dart'; @@ -21,10 +22,11 @@ class _BlogPostWidgetState extends State { Widget build(BuildContext context) { return InkWell( borderRadius: BorderRadius.circular(12), - onTap: () => GoRouter.of(context).pushNamed( - 'blogPostScreen', - extra: widget.feedBlogPostModel, - ), + onTap: () => + GoRouter.of(context).pushNamed( + 'blogPostScreen', + extra: widget.feedBlogPostModel, + ), child: Ink( decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), @@ -71,12 +73,15 @@ class _BlogPostWidgetState extends State { if (widget.feedBlogPostModel.title.isNotEmpty && widget.feedBlogPostModel.description.isNotEmpty) SizedBox(height: 8), Padding( padding: const EdgeInsets.symmetric(horizontal: 12), - child: Text( - widget.feedBlogPostModel.description, - style: TextStyle( - color: Colors.black87, - ), + child: Html( + data: widget.feedBlogPostModel.description, ), + // child: Text( + // widget.feedBlogPostModel.description, + // style: TextStyle( + // color: Colors.black87, + // ), + // ), ), if (widget.feedBlogPostModel.title.isNotEmpty || widget.feedBlogPostModel.description.isNotEmpty) SizedBox(height: 8), GestureDetector( @@ -106,19 +111,21 @@ class _BlogPostWidgetState extends State { _iconButton( icon: Icons.mode_comment_outlined, text: widget.feedBlogPostModel.totalComments.toString(), - onTap: () => GoRouter.of(context).pushNamed( - 'blogPostScreen', - extra: widget.feedBlogPostModel, - ), + onTap: () => + GoRouter.of(context).pushNamed( + 'blogPostScreen', + extra: widget.feedBlogPostModel, + ), ), SizedBox(width: 8), _iconButton( icon: Icons.reply_rounded, - onTap: () => Share.shareUri( - Uri.parse( - baseUrl + '/ru/blog_post/' + widget.feedBlogPostModel.id.toString(), - ), - ), + onTap: () => + Share.shareUri( + Uri.parse( + baseUrl + '/ru/blog_post/' + widget.feedBlogPostModel.id.toString(), + ), + ), ), Spacer(), Icon( diff --git a/lib/features/feed/repositories/feed_repository.dart b/lib/features/feed/repositories/feed_repository.dart index 0d2476ff..b217759d 100644 --- a/lib/features/feed/repositories/feed_repository.dart +++ b/lib/features/feed/repositories/feed_repository.dart @@ -1,5 +1,5 @@ import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart'; -import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart'; +import 'package:eatvio_app/features/feed/models/feed_blog_post_settings_model.dart'; import 'package:eatvio_app/features/feed/models/recipes_model.dart'; import 'package:eatvio_app/features/feed/services/feed_service.dart'; @@ -8,9 +8,9 @@ class FeedRepository { FeedRepository({required this.feedService}); - Future> getFeedBlogPostList() async { + Future getFeedBlogPosts({int page = 1}) async { try { - return (await feedService.getBlocPostList()).feedBlogPostList; + return (await feedService.getBlocPostList(page: page)); } catch (e) { rethrow; } diff --git a/lib/features/feed/services/feed_service.dart b/lib/features/feed/services/feed_service.dart index 0d848a56..3fbb2dce 100644 --- a/lib/features/feed/services/feed_service.dart +++ b/lib/features/feed/services/feed_service.dart @@ -10,8 +10,10 @@ part 'feed_service.g.dart'; abstract class FeedService { factory FeedService(Dio dio, {String baseUrl}) = _FeedService; - @GET('/api/blogPosts/index') - Future getBlocPostList(); + @GET('/api/blogPosts/index?page={page}') + Future getBlocPostList({ + @Path() required int page, + }); @GET('/api/recipes/index') Future getRecipes(); diff --git a/lib/features/feed/services/feed_service.g.dart b/lib/features/feed/services/feed_service.g.dart index 77b65773..36b29923 100644 --- a/lib/features/feed/services/feed_service.g.dart +++ b/lib/features/feed/services/feed_service.g.dart @@ -12,36 +12,45 @@ class _FeedService implements FeedService { _FeedService( this._dio, { this.baseUrl, + this.errorLogger, }); final Dio _dio; String? baseUrl; + final ParseErrorLogger? errorLogger; + @override - Future getBlocPostList() async { + Future getBlocPostList({required int page}) async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>( - _setStreamType(Options( + final _options = _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/blogPosts/index', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = FeedBlogPostSettingsModel.fromJson(_result.data!); + .compose( + _dio.options, + '/api/blogPosts/index?page=${page}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late FeedBlogPostSettingsModel _value; + try { + _value = FeedBlogPostSettingsModel.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -51,24 +60,30 @@ class _FeedService implements FeedService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/recipes/index', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = RecipesPagination.fromJson(_result.data!); + .compose( + _dio.options, + '/api/recipes/index', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late RecipesPagination _value; + try { + _value = RecipesPagination.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -78,24 +93,30 @@ class _FeedService implements FeedService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/diets/index', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = DietsPagination.fromJson(_result.data!); + .compose( + _dio.options, + '/api/diets/index', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late DietsPagination _value; + try { + _value = DietsPagination.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } diff --git a/lib/features/profile/services/profile_service.g.dart b/lib/features/profile/services/profile_service.g.dart index 83b66e99..79ebdb24 100644 --- a/lib/features/profile/services/profile_service.g.dart +++ b/lib/features/profile/services/profile_service.g.dart @@ -12,36 +12,45 @@ class _ProfileService implements ProfileService { _ProfileService( this._dio, { this.baseUrl, + this.errorLogger, }); final Dio _dio; String? baseUrl; + final ParseErrorLogger? errorLogger; + @override Future getProfileBySlug({required String slug}) async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = - await _dio.fetch>(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/profile/show/${slug}', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = Profile.fromJson(_result.data!); + .compose( + _dio.options, + '/api/profile/show/${slug}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late Profile _value; + try { + _value = Profile.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } diff --git a/lib/features/recipes/models/image.g.dart b/lib/features/recipes/models/image.g.dart index 3e44a28c..0d54e19f 100644 --- a/lib/features/recipes/models/image.g.dart +++ b/lib/features/recipes/models/image.g.dart @@ -10,6 +10,7 @@ _$ImageImpl _$$ImageImplFromJson(Map json) => _$ImageImpl( path: json['path'] as String, ); -Map _$$ImageImplToJson(_$ImageImpl instance) => { +Map _$$ImageImplToJson(_$ImageImpl instance) => + { 'path': instance.path, }; diff --git a/lib/features/recipes/presentation/bloc/recipe_create_cubit.dart b/lib/features/recipes/presentation/bloc/recipe_create_cubit.dart index 0790f2a4..6900f6b8 100644 --- a/lib/features/recipes/presentation/bloc/recipe_create_cubit.dart +++ b/lib/features/recipes/presentation/bloc/recipe_create_cubit.dart @@ -8,8 +8,7 @@ import 'package:image_picker/image_picker.dart'; class RecipeCreateCubit extends Cubit { final RecipeRepository recipeRepository; - RecipeCreateCubit({required this.recipeRepository}) - : super(const RecipeCreateState.loading()); + RecipeCreateCubit({required this.recipeRepository}) : super(const RecipeCreateState.loading()); loadRecipeCreate() { emit(const RecipeCreateStateLoading()); @@ -106,18 +105,14 @@ class RecipeCreateCubit extends Cubit { if (state is RecipeCreateStateLoaded) { var currentState = state as RecipeCreateStateLoaded; - bool ingredientExists = currentState.ingredients.any( - (existingIngredient) => - existingIngredient.product_name == ingredient.product_name); + bool ingredientExists = currentState.ingredients.any((existingIngredient) => existingIngredient.product_name == ingredient.product_name); if (ingredientExists) { - emit(RecipeCreateState.error( - errorMessage: 'Ингредиент уже существует.')); + emit(RecipeCreateState.error(errorMessage: 'Ингредиент уже существует.')); return; } - List newIngredients = - List.from(currentState.ingredients); + List newIngredients = List.from(currentState.ingredients); newIngredients.add(ingredient); var updatedState = currentState.copyWith(ingredients: newIngredients); @@ -134,13 +129,9 @@ class RecipeCreateCubit extends Cubit { var currentState = state as RecipeCreateStateLoaded; List newStepImages = List.from(currentState.stepImages); newStepImages.add(null); - List newStepControllers = - List.from(currentState.stepControllers); + List newStepControllers = List.from(currentState.stepControllers); newStepControllers.add(TextEditingController()); - var updatedState = currentState.copyWith( - stepImages: newStepImages, - stepControllers: newStepControllers, - numberOfSteps: currentState.numberOfSteps + 1); + var updatedState = currentState.copyWith(stepImages: newStepImages, stepControllers: newStepControllers, numberOfSteps: currentState.numberOfSteps + 1); emit(updatedState); } } catch (e) { @@ -154,13 +145,9 @@ class RecipeCreateCubit extends Cubit { var currentState = state as RecipeCreateStateLoaded; List newStepImages = List.from(currentState.stepImages); newStepImages.removeLast(); - List newStepControllers = - List.from(currentState.stepControllers); + List newStepControllers = List.from(currentState.stepControllers); newStepControllers.removeLast(); - var updatedState = currentState.copyWith( - stepImages: newStepImages, - stepControllers: newStepControllers, - numberOfSteps: currentState.numberOfSteps - 1); + var updatedState = currentState.copyWith(stepImages: newStepImages, stepControllers: newStepControllers, numberOfSteps: currentState.numberOfSteps - 1); emit(updatedState); } } catch (e) { diff --git a/lib/features/recipes/services/recipe_service.g.dart b/lib/features/recipes/services/recipe_service.g.dart index 04b47319..7e946a4c 100644 --- a/lib/features/recipes/services/recipe_service.g.dart +++ b/lib/features/recipes/services/recipe_service.g.dart @@ -12,37 +12,46 @@ class _RecipeService implements RecipeService { _RecipeService( this._dio, { this.baseUrl, + this.errorLogger, }); final Dio _dio; String? baseUrl; + final ParseErrorLogger? errorLogger; + @override Future> getRecipe(int id) async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>( - _setStreamType>(Options( + final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/recipe/${id}/show/', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - var _value = _result.data!.map((k, dynamic v) => - MapEntry(k, RecipeModel.fromJson(v as Map))); + .compose( + _dio.options, + '/api/recipe/${id}/show/', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late Map _value; + try { + _value = _result.data!.map((k, dynamic v) => + MapEntry(k, RecipeModel.fromJson(v as Map))); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } diff --git a/lib/features/registration/services/registration_service.g.dart b/lib/features/registration/services/registration_service.g.dart index 9820fd33..4aaccede 100644 --- a/lib/features/registration/services/registration_service.g.dart +++ b/lib/features/registration/services/registration_service.g.dart @@ -12,12 +12,15 @@ class _RegistrationService implements RegistrationService { _RegistrationService( this._dio, { this.baseUrl, + this.errorLogger, }); final Dio _dio; String? baseUrl; + final ParseErrorLogger? errorLogger; + @override Future> register( {required Map sheet}) async { @@ -26,24 +29,30 @@ class _RegistrationService implements RegistrationService { final _headers = {}; final _data = {}; _data.addAll(sheet); - final _result = await _dio.fetch>( - _setStreamType>(Options( + final _options = _setStreamType>(Options( method: 'POST', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/register', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = _result.data!.cast(); + .compose( + _dio.options, + '/api/register', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late Map _value; + try { + _value = _result.data!.cast(); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -53,24 +62,30 @@ class _RegistrationService implements RegistrationService { final queryParameters = {r'user_address': query}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/location_by_address', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = LocationModel.fromJson(_result.data!); + .compose( + _dio.options, + '/api/location_by_address', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late LocationModel _value; + try { + _value = LocationModel.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } @@ -86,24 +101,30 @@ class _RegistrationService implements RegistrationService { }; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType(Options( + final _options = _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/location_by_coordinate', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = LocationModel.fromJson(_result.data!); + .compose( + _dio.options, + '/api/location_by_coordinate', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + ))); + final _result = await _dio.fetch>(_options); + late LocationModel _value; + try { + _value = LocationModel.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } return _value; } diff --git a/lib/main.dart b/lib/main.dart index e1f41274..8a9f334c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -73,7 +73,6 @@ class MyApp extends StatelessWidget { ], child: MaterialApp.router( theme: theme, - title: 'Eatvio', routerConfig: AppRouter.appRouter, debugShowCheckedModeBanner: false, localizationsDelegates: [ @@ -85,7 +84,6 @@ class MyApp extends StatelessWidget { supportedLocales: [ Locale( 'ru', - '', ), ], ), diff --git a/pubspec.yaml b/pubspec.yaml index 53063a20..02db5422 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -44,11 +44,13 @@ dependencies: lazy_load_scrollview: ^1.3.0 badges: ^3.1.2 google_fonts: ^6.2.1 - location: ^7.0.0 + location: 6.0.2 syncfusion_flutter_charts: ^26.2.8 table_calendar: ^3.1.2 flutter_keyboard_visibility: ^6.0.0 share_plus: ^10.0.0 + flutter_html: 3.0.0-beta.2 + file_picker: ^8.1.1 dev_dependencies: build_runner: ^2.4.11